WC -Sx- Jones wrote:


Any ideas?


:) Didn't your mother teach it's not nice to play with your code?

But I like it :)


perldoc -f require is very much similar what you are doing already...

I can get require() to do the same thing as use, import the module only not the exported stuff..


perl -mstrict -we 'use Foo qw(mod);if(mod("CGI")) { print CGI::header(); }'

Will work whether I do the require or use way....

require doesn't let you specify what to EXPORT though which is one of the goals of this funtion...

use does import the module's name *and* does the EXPORT symbols also *if* its called inside package Foo;

so
 package Foo;
 ...
 if(mod("CGI","header")) { print header(); }'
 ...
works but

perl -mstrict -we 'use Foo qw(mod);if(mod("CGI","header")) { print header(); }'

does not and that is what I need it to do...

It seems like there's a name space issue but I can't quite get it...

Its importing header() into Foo:: since it is executed in Foo::
but I need mod() to be in Foo and import to (caller())[0]

Any ideas on how to do that?

That is, eval a use statement to chekc and see if a module and the items chosen for export are available and if so import them in to the calling name space and if not handle $@ however you want...

Lee.M - JupiterHost.Net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to