inspect the parameters to "use", and pass on the rest?

Posted by JoelFan on Stack Overflow See other posts from Stack Overflow or by JoelFan
Published on 2010-03-08T21:13:15Z Indexed on 2010/03/08 22:36 UTC
Read the original article Hit count: 208

Filed under:
|
|

I have a Perl module and I'd like to be able to pick out the parameters that my my module's user passed in the "use" call. Whichever ones I don't recognize I'd like to pass on. I tried to do this by overriding the "import" method but I'm not having much luck.

EDIT:

To clarify, as it is, I can use my module like this:

use MyModule qw/foo bar/;

which will import the foo and bar methods of MyModule. But I want to be able to say:

use MyModule qw/foo doSpecialStuff bar/;

and look for doSpecialStuff to check if I need to do some special stuff at the beginning of the program, then pass qw/foo bar/ to the Exporter's import

© Stack Overflow or respective owner

Related posts about perl

Related posts about module