anyone know why extract_links() isn't working?

Matt Silvia (msilvia@mathworks.com)
Wed, 29 Oct 1997 16:42:11 -0500


Hi there...

I'm having trouble getting the extract_links() method of
HTML::TreeBuilder to work.

More specifically, I use a UserAgent to execute a request and return a
response object, and then use HTML::Parse::parse_html to create a tree
object.

I try to run the extract links method of this tree, but it seems as if
it's not extracting anything from the tree.

Does anyone know what I'm doing wrong?

Thanks,

    Matt

----
example code, comments and declarations removed:


$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

$URL = 'http://www.somethin.com/';

my $req = new HTTP::Request POST => $URL;
$req->content_type('application/x-www-form-urlencoded');
$req->content('');

my $response = $ua->request($req);
$html = $response->content();
$tree = HTML::Parse::parse_html($html);

    for (@{ $tree->extract_links( qw(a) ) }) {
        $link = $_->[0];
        print "$link\n";
   }