annotate _test/any.pl @ 13:bb8d67f811ea

merge heads
author Sergey
date Wed, 02 Sep 2009 23:11:14 +0400
parents 75980091813b
children 818c74b038ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
75980091813b DOM и навигация
Sergey
parents:
diff changeset
1 #!/usr/bin/perl -w
75980091813b DOM и навигация
Sergey
parents:
diff changeset
2 #use strict;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
3
75980091813b DOM и навигация
Sergey
parents:
diff changeset
4 use HTML::Element;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
5 $a = HTML::Element->new('a', href => 'http://www.perl.com/');
75980091813b DOM и навигация
Sergey
parents:
diff changeset
6 $a->push_content("The Perl Homepage");
75980091813b DOM и навигация
Sergey
parents:
diff changeset
7
75980091813b DOM и навигация
Sergey
parents:
diff changeset
8 $tag = $a->tag;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
9 print "$tag starts out as:", $a->starttag, "\n";
75980091813b DOM и навигация
Sergey
parents:
diff changeset
10 print "$tag ends as:", $a->endtag, "\n";
75980091813b DOM и навигация
Sergey
parents:
diff changeset
11 print "$tag\'s href attribute is: ", $a->attr('href'), "\n";
75980091813b DOM и навигация
Sergey
parents:
diff changeset
12
75980091813b DOM и навигация
Sergey
parents:
diff changeset
13 $links_r = $a->extract_links();
75980091813b DOM и навигация
Sergey
parents:
diff changeset
14 print "Hey, I found ", scalar(@$links_r), " links.\n";
75980091813b DOM и навигация
Sergey
parents:
diff changeset
15
75980091813b DOM и навигация
Sergey
parents:
diff changeset
16 print "And that, as HTML, is: ", $a->as_HTML, "\n";
75980091813b DOM и навигация
Sergey
parents:
diff changeset
17 $a = $a->delete;
75980091813b DOM и навигация
Sergey
parents:
diff changeset
18
75980091813b DOM и навигация
Sergey
parents:
diff changeset
19