Thanks, AnomalousMonk, for the explanation. Your statement:
the CORE namespace has search precedence.
raises a new question: How, then, does the original code ever find the print sub defined in namespace main if the sub isn’t explicitly qualified with its namespace (i.e., main::print)? Why doesn’t Perl always find CORE::print?
I think I found the answer: the original code works only because it uses a reference to the sub:
-command=> \&print
and in this case the reference is disambiguated using lexical scope. I found an explanation of the latter in the Camel Book, 4th Edition, “Name Lookups,” pages 62–65. Is there any documentation on how Perl looks up subroutine names when a subroutine is actually called (as opposed to being referenced)?
Thanks,
Athanasius <°(((>< contra mundum
In reply to Re^3: Entry Widget - validatecommand
by Athanasius
in thread Entry Widget - validatecommand
by shortyfw06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |