comparison _test/any.pl @ 18:818c74b038ae

DOM Schema + tests
author Sergey
date Thu, 10 Sep 2009 17:42:47 +0400
parents 75980091813b
children 1828103371d0
comparison
equal deleted inserted replaced
17:7f88e01b58f8 18:818c74b038ae
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 #use strict; 2 use strict;
3 3
4 use HTML::Element; 4 my @data = (1,2,3,4);
5 $a = HTML::Element->new('a', href => 'http://www.perl.com/');
6 $a->push_content("The Perl Homepage");
7 5
8 $tag = $a->tag; 6 sub func {
9 print "$tag starts out as:", $a->starttag, "\n"; 7 return \@data;
10 print "$tag ends as:", $a->endtag, "\n"; 8 }
11 print "$tag\'s href attribute is: ", $a->attr('href'), "\n";
12 9
13 $links_r = $a->extract_links(); 10 print "$_\n" and $data[3]=0 foreach @{func()};
14 print "Hey, I found ", scalar(@$links_r), " links.\n";
15
16 print "And that, as HTML, is: ", $a->as_HTML, "\n";
17 $a = $a->delete;
18
19