jredburn has asked for the wisdom of the Perl Monks concerning the following question:
I would like to have a module with exported functions (there may be a class-based solution to this problem which I'd be very open to, as well) that has a number of different scripts which use it. So say we have a module M with an exported function x. What I'd like is to be able to call x in a script S with use M;. So we execute M::x. I'd like to define x something like this:
where _x is a function in S. Is this possible? Right now it looks for _x in M, which is not where it is, obviously. I would like to have M have no knowledge of the various scripts that will end up using it.sub x { return unless &_x; ...; &_x; }
|
---|
Back to
Seekers of Perl Wisdom