in reply to Re^3: Use of $AUTOLOAD and strict
in thread Use of $AUTOLOAD and strict
I must confess I have a little trouble discerning the difference between the creation and population of $AUTOLOAD vs. the creation and population of @_ as you describe it. Except that you get an error for trying to use $AUTOLOAD without explicitly declaring it.
And, obviously, it is only used for AUTOLOAD functions. Also, perl doesn't create it for you ... but that's the problem that started this whole talk, how do we know when perl creates it for you.
But I'm no C programmer or system hacker, so I'm probably missing certain nuances ;->
Maybe the answer is that, "within a given package, perl does *not* always need to create $AUTOLOAD, but it does always need to create @_". It's pretty rare to not need @_ but very common to not need $AUTOLOAD.
It just seems weird to me that perl doesn't see sub AUTOLOAD{ and automagically create and localize $AUTOLOAD. Seems arbitrary. Unlike @_ within sub, $AUTOLOAD is *always* populated within sub AUTOLOAD.
Sigh. I don't know why they didn't just make $AUTOLOAD the second param in sub AUTOLOAD, ie my ($self, $autoload) = @_.
My head hurts.
|
|---|