NAME
WWW::Class - OO interface to LWP::Simple.
DESCRIPTION
WWW::Class is a simple module to parse Websites in a Object Oriented fashion. It separates everything into classes for easy management, which also allows you to create your own methods for each class.
SYNOPSIS
package main;
use base 'WWW::Class';
my $c = main->uri('http://www.google.co.uk');
print "Server: " . $c->header->server;
# iterate all links found on page
foreach (@{$c->links}) {
print $_ . "\n";
}
# iterate the links, but also return their response code or 'Failed'
my $links = $c->links({ check => 1 });
for (keys %$links) {
print "$_ => $links->{$_}\n";
}
# need access to a different header accessor?
$c->header->method( xcache => sub {
return shift->{xcache};
});
print $c->header->xcache;
uri
Returns the WWW::Class::Html class on a successful response code (200). Otherwise will return an error class.
package main;
use base 'WWW::Class';
my $c = main->uri('http://localhost');
if ($c->err) { die $c->err; }
print "Connected\n";