<
%flags>
inherit => undef
%flags>
<%args>
$terms
$url
%args>
<%init>
use LWP::UserAgent;
use HTTP::Cookies;
$m -> redirect($url) if ($url =~ /foliocgi/);
my $geturl = 'http://localhost'. $url;
my $baseurl = 'http://'.$r -> hostname().$url;
# set up http retrieval
my $ua = LWP::UserAgent->new();
my $jar = HTTP::Cookies -> new();
$ua->agent("LIIDisplayGrabber/1.0");
$jar -> set_cookie(
1,
'LIIDonorOK',
'yes',
'/',
'.law.cornell.edu',
'80',
0,
0,
3600,
0,
{}
);
$ua -> cookie_jar($jar);
my $resp = $ua -> get($geturl);
my $content = $resp -> content();
$terms =~ s/\[/ /sig;
$terms =~ s/\]/ /sig;
$terms =~ s/\band\b/ /sig;
$terms =~ s/\bor\b/ /sig;
$terms =~ s/\bnot\b/ /sig;
$terms =~ s/\b(.*?)=/ /sig;
my @tlist = split(/\s+/, $terms);
my ($head, $body) = split(/<\/HEAD>/i, $content);
my @bodylist = split(/(<[^>]+>)/, $body);
foreach my $bodyitem(@bodylist){
foreach my $t (@tlist){
$bodyitem =~ s/($t)/$1<\/SPAN>/sig unless $bodyitem =~ /^;
}
}
%init>
<% $head %>