[ic] use get_url perl error ....

Dan Browning interchange-users@icdevgroup.org
Thu Aug 29 04:24:04 2002


At 10:05 AM 8/29/2002 +0200, you wrote:

>When I use $Tag->get_url I have this error in my log file
>
>192.168.1.53 EFH6XnVM:192.168.1.53 - [29/August/2002:09:23:27 +0200] test 
>/cgi-
>bin/test/ord/payment.html Safe: require trapped by operation mask
>at /usr/lib/perl5/5.6.1/i386-linux/IO/Socket.pm line 9.
> > Compilation failed in require at 
> /usr/lib/perl5/site_perl/5.6.0/LWP/Simple.pm
>line 296.
> >
> >
> >    return $Tag->get_url( "http://www.virgilio.it/" );
> >
> >
>
>I use a RedHat 7.2 and perl-libwww-perl-5.53-3

Answered yesterday & a long time ago.  I better get this in the FAQ soon...

/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| Dan Browning, Kavod Technologies      <dan.browning@kavod.com> |
| (360) 882-7872 x7, 6700 NE 162nd Ave, Suite 210, Vancouver, WA |
\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
A lot of people are afraid of heights.  Not me.  I'm afraid of widths.
                 -- Steve Wright




Quoting Roberta - Interline S.r.l. (roberta@interline.it):
 > Why in this mode is OK
 >
 > [get-url http://www.myurl.org]
 >
 > and in this mode NO
 >
 > [perl]
 > $Tag -> get_url ("http://www.myurl.org");
 > return $Tag
 > [/perl]


If you look in the error logs you will probably see a "require operation 
blocked
by Safe" or something like that.


If you move the "require" for LWP above the sub call opening, it may work,
but it depends on your LWP version. I think I have patched the one on
DEVEL cvs to do that:


UserTag get-url Order url
UserTag get-url AddAttr
UserTag get-url Routine <<EOR
require LWP::Simple;
sub {
         my ($url, $opt) = @_;
         my $html = LWP::Simple::get($url);
         if($opt->{strip}) {
                 $html =~ s/.*<body[^>]*>//si;
                 $html =~ s:</body>.*::si;
         }
         return $html;
}
EOR