# The URL itself is queried from the database above here,
# but that isn't important for this particular explanation
#
# The URL itself is stored in $url_uri from bind_col()
while ($sth->fetch) {
my $substr_url_uri;
$substr_url_uri = length ($url_uri) > 60
? substr($url_uri,0,60) . "..."
: $url_uri;
print br(), "\n"x3,
start_div({-class=>'urlbox'}),
span({-class=>'urlinfo'},
b("$url_name"), br(),
br(), "Current category:",
start_span({-class=>'catname'}),
$category_name,
end_span(), br()x2,
start_span({-class=>'catlist'}),
"Move to new category:", br(),
popup_menu("category", \@categories),
end_span(),
), end_div(),
start_div({-class=>'urlprev'}),
start_iframe({-src => "$url_uri",
-width => '170',
-height => '170',
-scrolling => 'no',
-marginwidth => '1',
-marginheight => '1',
-frameborder => '0',}),
end_iframe,
end_div(),
}
$sth->finish;
####
sub fetch_url {
my $url_uri = shift;
my $ua = LWP::UserAgent->new;
$ua->agent('Mozilla/3.0');
my $url = "$url_uri";
my $request = HTTP::Request->new(GET => $url);
my $response = $ua->request($request);
# Content itself is in $response->content; here.
return $response->content;
}
####
open(CONTENT, ">content.$$") or die $!
print CONTENT $response->content;
close CONTENT;