#!/usr/bin/perl --
use strict; use warnings;
use HTML::Tree;
use Data::Dump qw/dd pp /;
my $t = HTML::Tree->new_from_content(q{
1
q
ERR
});
dd( $t );
for my $l ( $t->look_down( qw/ _tag a /) ){
{
local $$l{_parent};
dd( $l );
}
dd( ref $l, $l->tag, $l->attr('href'), $l->as_text );
}
for my $leat (@{ $t->extract_links( ) }) {
my($link, $element, $attr, $tag) = @$leat;
print
"Hey, there's a '$tag' that links to ",
$link, ", in its '$attr' attribute, at ",
$element->address(), ".\n";
}
print "\n", $t->as_HTML(undef, ' ');
__END__