line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::DOM::NodeList; |
2
|
|
|
|
|
|
|
|
3
|
29
|
|
|
29
|
|
53012
|
use strict; |
|
29
|
|
|
|
|
52
|
|
|
29
|
|
|
|
|
655
|
|
4
|
29
|
|
|
29
|
|
110
|
use warnings; |
|
29
|
|
|
|
|
38
|
|
|
29
|
|
|
|
|
1202
|
|
5
|
29
|
|
|
29
|
|
989
|
use overload fallback => 1, '@{}' => sub { ${$_[0]} }; |
|
29
|
|
|
373
|
|
739
|
|
|
29
|
|
|
|
|
209
|
|
|
373
|
|
|
|
|
1345
|
|
|
373
|
|
|
|
|
911
|
|
6
|
|
|
|
|
|
|
|
7
|
29
|
|
|
29
|
|
1742
|
use Scalar::Util 'weaken'; |
|
29
|
|
|
|
|
41
|
|
|
29
|
|
|
|
|
3505
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.058'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# new NodeList \@array; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
74
|
|
|
74
|
0
|
230
|
bless do {\(my $x = $_[1])}, shift; |
|
74
|
|
|
|
|
459
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub item { |
19
|
349
|
50
|
|
349
|
1
|
331
|
${$_[0]}[$_[1]] || () |
|
349
|
|
|
|
|
546
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub length { |
23
|
67
|
|
|
67
|
1
|
208
|
scalar @${$_[0]} |
|
67
|
|
|
|
|
377
|
|
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.058 |
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 |