[ic] get-url

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Wed Aug 28 13:24:01 2002


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

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Software axiom: Lack of speed kills.