How to use LWP::Simple inside a safe compartment?

2001-12-19 Thread Christoph Bergmann

Hi...


I want to use LWP::Simple inside a safe compartment created with the
Safe Module. But it ends up with errors like Can't locate object method
new via package LWP::UserAgent at line... or Require trapped by
operation mask...

Here is how the code looks like (shortened ;-) ): 

$codefromoutside='print wget http://google.com;;';

use LWP::Simple ();
sub wget { LWP::Simple::get $_[0] }

use Safe;
$safe=new Safe; $safe-share(qw(wget));

$safe-reval($codefromoutside);
 print $@ if $@;

(There is a reason why I use wget instead of get directly because I
have already a subroutine with the name get elsewhere)

I tried some other things but they all didn't work. Does anybody know
how to use LWP::Simple::get inside a save compartment?

Thanks in advance,

Best regards,

Christoph Bergmann 


PS: Sorry for this is not a 100% mod_perl question but I haven't get any
help anywhere else right now and the problem results from running unkown
code under mod_perl (thats why I need the safe module), so chances are
that this is a common problem under mod_perl...




How to use LWP::Simple inside a safe compartment?

2001-12-12 Thread Christoph Bergmann

Hi...


I want to use LWP::Simple inside a safe compartment created with the
Safe Module. But it ends up with errors like Can't locate object method
new via package LWP::UserAgent at line... or Require trapped by
operation mask...

Here is how the code looks like (shortened ;-) ): 

$codefromoutside='print wget http://google.com;;';

use LWP::Simple ();
sub wget { LWP::Simple::get $_[0] }

use Safe;
$safe=new Safe; $safe-share(qw(wget));

$safe-reval($codefromoutside);
 print $@ if $@;

(There is a reason why I use wget instead of get directly because I
have already a subroutine with the name get elsewhere)

I tried some other things but they all didn't work. Does anybody know
how to use LWP::Simple::get inside a save compartment?

Thanks in advance,

Best regards,

Christoph Bergmann 


PS: Sorry for this is not a 100% mod_perl question but I haven't get any
help anywhere else right now and the problem results from running unkown
code under mod_perl (thats why I need the safe module), so chances are
that this is a common problem under mod_perl...