|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Using import to generate subroutinesby Thilosophy (Curate) |
| on Nov 23, 2004 at 20:27 UTC ( [id://410032]=perlquestion: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.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
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||