line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::DOM::NodeList; |
2
|
|
|
|
|
|
|
|
3
|
29
|
|
|
29
|
|
13322
|
use strict; |
|
29
|
|
|
|
|
27
|
|
|
29
|
|
|
|
|
627
|
|
4
|
29
|
|
|
29
|
|
84
|
use warnings; |
|
29
|
|
|
|
|
25
|
|
|
29
|
|
|
|
|
1045
|
|
5
|
29
|
|
|
29
|
|
939
|
use overload fallback => 1, '@{}' => sub { ${$_[0]} }; |
|
29
|
|
|
373
|
|
748
|
|
|
29
|
|
|
|
|
152
|
|
|
373
|
|
|
|
|
697
|
|
|
373
|
|
|
|
|
897
|
|
6
|
|
|
|
|
|
|
|
7
|
29
|
|
|
29
|
|
1350
|
use Scalar::Util 'weaken'; |
|
29
|
|
|
|
|
28
|
|
|
29
|
|
|
|
|
3061
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.056'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# new NodeList \@array; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
74
|
|
|
74
|
0
|
109074
|
bless do {\(my $x = $_[1])}, shift; |
|
74
|
|
|
|
|
458
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub item { |
19
|
349
|
50
|
|
349
|
1
|
205
|
${$_[0]}[$_[1]] || () |
|
349
|
|
|
|
|
475
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub length { |
23
|
67
|
|
|
67
|
1
|
52
|
scalar @${$_[0]} |
|
67
|
|
|
|
|
256
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1 __END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 NAME |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
HTML::DOM::NodeList - Simple node list class for HTML::DOM |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 VERSION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Version 0.056 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use HTML::DOM; |
39
|
|
|
|
|
|
|
$doc = HTML::DOM->new; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$list = $doc->body->childNodes; # returns an HTML::DOM::NodeList |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$list->[0]; # first node |
44
|
|
|
|
|
|
|
$list->item(0); # same |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$list->length; # same as scalar @$list |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This implements the NodeList interface as described in the W3C's DOM |
51
|
|
|
|
|
|
|
standard. In addition to the methods below, you can use a node list object |
52
|
|
|
|
|
|
|
as an array. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This class actually only implements those node lists that are based on |
55
|
|
|
|
|
|
|
array references (as returned by C methods). The |
56
|
|
|
|
|
|
|
L class is used for more |
57
|
|
|
|
|
|
|
complex node lists that call a code ref to update themselves. This is an |
58
|
|
|
|
|
|
|
implementation detail though, that you shouldn't have to worry about. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item $list->length |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Returns the number of items in the array. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item $list->item($index) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Returns item number C<$index>, numbered from 0. Note that you can also use |
71
|
|
|
|
|
|
|
C<< $list->[$index] >> for short. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SEE ALSO |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |