NAME
WWW::Class::Html - Core HTML class for WWW::Class
DESCRIPTION
This module takes care of the core of WWW::Class. ie: The headers, links, etc.
header
Originally named head, but thanks to LWP::Simple's namespace polution it needed to be renamed. This returns the headers of your object.
print $c->header; # returns the WWW::Class::Header class
print $c->header->server; # returns the server
print $c->header->code; # get the response code (ie: 200, 404, 301, 302)
links
Parses the entire body for all known links. Currently only searches anchors, but future realises will look at Javascript, frames, etc.. Without arguments returns an array of all the links. If you specify a hash ref with the option 'check', it will return a hashref of the links as the name and the value will be their response code. Handy to see if links are broken or not.
# iterate through all the links on the page
for my $link (@{$c->links}) {
print $link . "\n";
}
# iterate through the links and return the response code
my $links = $c->links({ check => 1 });
foreach my $link (keys %$links) {
print "$link => $links->{$link}\n";
}
BUGS
Please e-mail bradh@cpan.org
AUTHOR
Brad Haywood <bradh@cpan.org>
COPYRIGHT & LICENSE
Copyright 2011 the above author(s).
This sofware is free software, and is licensed under the same terms as perl itself.