Think about Loose Coupling | |
PerlMonks |
Using import to generate subroutinesby Thilosophy (Curate) |
on Nov 24, 2004 at 01:27 UTC ( [id://410032]=perlquestion: print w/replies, xml ) | Need Help?? |
Thilosophy has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks,
I have a question about the import/export mechanism. I would like to write an "import" that dynamically creates subroutines and installs them into the calling module. The content of the subroutine can be derived from just the subroutine name. For example:
The subroutine Wow, for example would have been created by MyProcedures::import . I figure I cannot use the standard Exporter for this, so how do I write my own "import" ? Just eval() a string that produces the subroutine? Or make a closure and assign it to the caller's symbol table? Or somehow else?
Back to
Seekers of Perl Wisdom
|
|