[Kc] curious $AUTOLOAD package binding

ironicface at earthlink.net ironicface at earthlink.net
Fri Jul 16 14:30:14 PDT 2010


Is this a problem?
If $AUTOLOAD operates within an assignment, does it make sense that it use the package providing the assignment?

Does it create cross package problems?

In a sense, if you declare the AUTOLOAD, you are overiding the default.
You are managing the capability yourself.

If there is not a problem in how it works, then it would seem the documentation is in error, and should be clarified.

Teal

>with perl v5.10.1 on cygwin:
>
>Documentation about the $AUTOLOAD variable states that it is a package
>variable in the same package where the AUTOLOAD routine is found. This
>is not always true. Apparently when an AUTOLOAD routine is added by
>assignment to glob instead of by declaration, $AUTOLOAD within it is
>bound to the package in effect at the assignment.
>

>It appears that what package $AUTOLOAD binds to is affected by the
>subroutine declaration, while the resolution of $AUTOLOAD is governed
>by normal scoping rules.
>
>The documentation seems to say that the package's $AUTOLOAD that gets
>the goods is the package where the AUTOLOAD routine was found, but the
>above examples where AUTOLOAD is explicitly assigned to a glob instead
>of getting declared indicate otherwise.
>
>
>
>
>
>Thoughts? Should I try to escalate this?
>_______________________________________________
>kc mailing list
>kc at pm.org
>http://mail.pm.org/mailman/listinfo/kc



More information about the kc mailing list