Hello list!

I have a simple thing I know I'm missing something obvious...

If I have this:
 my $e = 'use CGI qw(url param);';
 eval $e;
 die $@ if $@;
 print url();
 for(param()) {
  print "$_\n\t" . join("\n\t", param($_));print "\n";
 }

I realize that it is better practice to just use CGI but assume I want
to use the eval to make sure I have a module a bit less comman than CGI
and handle it if I do not...

Now heres the kicker, that code above works perfect.

However I'd like to make it a funtion that is part of a package..

So I can do:

use Foo 'mod blah';

if(mod('Funky','funcarg arg')) {
  print funcarg(1,2,3);
} else { die "you need Funky"; }

In this case it will get Funky but not export the functions
So I can go Funky::funcarg(..) and it will work

now mod() works perfect when used in the package:

package Foo;

...

sub blah {
 if(mod('Funky','funcarg arg')) {
  return funcarg(1,2,3);
 } else { seterr("you need Funky");return 0; }
}

so how can I get it to not only get the Module into the script (IE Funky::) but export the export list into the main script and not limit it to the package?


After I check that the supplied module name is a valid looking module name:


  my $e = @_ ? qq(use $m qw(@_);) : qq(use $m;);
  eval $e;

then I return true if !$@ false if not

Like I said it works great id I call it inside the package..
print "-$e-\n"; , it looks right also...)

Any ideas?

TIA

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