|
OK I give up what's wrong with this program?
It prints a warning, then it prints 4 lines of "link:" without showing the link, then the 4 lines with the hrefs. It's as though the links method returns a list of blanks:
#!/usr/bin/perl -wT
use strict;
use diagnostics;
use warnings;
use HTML::SimpleLinkExtor;
my $html = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<HTML>
<BODY>
<A HREF="http://www.google.com">Google</A>
<A HREF="http://www.example.com">Example</A>
<A HREF="http://www.bandsman.co.uk">Bandsman</A>
<A HREF="http://www.concert-bands.co.uk">Concert Bands</A>
</BODY>
</HTML>
';
my $base = "http://www.bandsman.co.uk/band-links.htm";
my $extor = HTML::SimpleLinkExtor->new($base);
unless($extor) {
print "no links found\n";
exit;
}
$extor->parse($html);
foreach ($extor->links) {
print "link: " . $_ . "\n";
}
foreach ($extor->a) {
print "href: " . $_ . "\n";
}
|