1 use Test::More tests => 4;
3 require HTML::LinkExtor;
7 <base href="http://www.sn.no/">
9 <body background="http://www.sn.no/sn.gif">
11 This is <A HREF="link.html">link</a> and an <img SRC="img.jpg"
12 lowsrc="img.gif" alt="Image">.
16 # Try the callback interface
18 $p = HTML::LinkExtor->new(
20 my($tag, %links) = @_;
21 #diag "$tag @{[%links]}";
22 $links .= "$tag @{[%links]}\n";
25 $p->parse($HTML); $p->eof;
27 ok($links =~ m|^base href http://www\.sn\.no/$|m);
28 ok($links =~ m|^body background http://www\.sn\.no/sn\.gif$|m);
29 ok($links =~ m|^a href link\.html$|m);
31 # Used to be problems when using the links method on a document with
32 # no links it it. This is a test to prove that it works.
33 $p = new HTML::LinkExtor;
34 $p->parse("this is a document with no links"); $p->eof;