Re: AUTLOAD and $_
by John Macdonald other posts by this author
Jun 20 2005 5:10PM messages near this date
Re: AUTLOAD and $_
|
Re: AUTLOAD and $_
On Mon, Jun 20, 2005 at 04:37:31PM -0600, Luke Palmer wrote:
> On 6/20/05, chromatic <chromatic@[...].org> wrote:
> > On Mon, 2005-06-20 at 12:11 +0200, Juerd wrote:
> >
> > > I think there exists an even simpler way to avoid any mess involved.
> > > Instead of letting AUTOLOAD receive and pass on arguments, and instead
> > > of letting AUTOLOAD call the loaded sub, why not have AUTOLOAD do its
> > > thing, and then have *perl* call the sub?
> >
> > Who says AUTOLOAD will always either call a loaded sub or fail?
>
> Uh, what else can it do? It doesn't have to load a sub to return a
> code reference.
>
> Luke
I recall Damian using AUTOLOAD (in perl5) to evaluate the
result of the function call without loading a function with the
given name. This was to allow arbitrary names to be invoked,
when the same name is unlikely to be used again. This was
basically a method that took a string contant argument, but
it used the method name as the constant and didn't need to
specify a name for the actual ccmmon method.
I'm not certain that this is actually a worth supporting, it's
more of a golf/obfuscation technique than a significant tool,
unless there are additional clever uses of the technique that
go beyond this basic trick.
--
Thread:
Sam Vilain
Juerd
Sam Vilain
Maxim Sloyko
Juerd
Adam Kennedy
Juerd
Luke Palmer
Chromatic
Juerd
Chromatic
Juerd
Luke Palmer
John Macdonald
Chromatic
Juerd
Rod Adams
Larry Wall
Rod Adams
Chromatic
Juerd
Sam Vilain
Sam Vilain
Juerd
|