develooper Front page | perl.perl5.porters | Postings from March 2000


Thread Previous
Ilya Zakharevich
March 15, 2000 10:55
Message ID:
M.J.T. Guy writes:
> All these problems have the same root cause  -  the fact that you can't
> load a subroutine without also calling it.

Nope, they have two roots: this one, and that you cannot run some
action when an undefined subroutine is seen at *compile* time.

See my proposal on 'use autoload'.

> So I propose a new reserved subroutine AUTOLOADREF.   (The name is
> deliberately ugly to encourage people to make better suggestions.
> Also see below for an alternative to a new reserved word.)

No new magic names, please!  In my proposal what you want would be
installed by

  use autoload body => \&AUTOLOADREF;

But there is an additional (and separate!) callback to be called at
compile time:

  use autoload proto => whatever;

which should return the prototype (but may have an arbitrary side
effect like defining the subroutine).


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About