Are you sure you don't wan't use y; or require y; in z.pm?? This means that your depending on y.pm being loaded somewhere else, which is a pretty big trap for someone, yourself probably, debugging latter.
In any case, if you only want to use it from within package z, you could do this in y.pm
If you don't like "G::global_sub", how about "::global_sub"? Think of '::' as a sigil (or twigil) for global. And as long as you use package declartions everywhere, you won't stomp on anyone elses namespace.sub z::global_sub { print "global_sub working!"; }
In reply to Re: How to declare globally visible subroutine like built-in ones ? Is it possible?
by Anonymous Monk
in thread How to declare globally visible subroutine like built-in ones ? Is it possible?
by bdimych
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |