line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## HTML Object - ~/lib/HTML/Object/DOM/Root.pm |
3
|
|
|
|
|
|
|
## Version v0.2.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2021 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2021/12/13 |
7
|
|
|
|
|
|
|
## Modified 2022/09/18 |
8
|
|
|
|
|
|
|
## All rights reserved |
9
|
|
|
|
|
|
|
## |
10
|
|
|
|
|
|
|
## |
11
|
|
|
|
|
|
|
## This program is free software; you can redistribute it and/or modify it |
12
|
|
|
|
|
|
|
## under the same terms as Perl itself. |
13
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
package HTML::Object::DOM::Root; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
4
|
|
|
4
|
|
2130
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
128
|
|
18
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
124
|
|
19
|
4
|
|
|
4
|
|
21
|
use parent qw( HTML::Object::Root HTML::Object::DOM::Node ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
24
|
|
20
|
4
|
|
|
4
|
|
334
|
use vars qw( $VERSION ); |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
175
|
|
21
|
4
|
|
|
4
|
|
76
|
our $VERSION = 'v0.2.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
99
|
|
25
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
1049
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
1
|
|
my $self = shift( @_ ); |
30
|
0
|
|
|
|
|
|
$self->{_init_strict_use_sub} = 1; |
31
|
0
|
0
|
|
|
|
|
$self->HTML::Object::Root::init( @_ ) || return( $self->pass_error ); |
32
|
0
|
|
|
|
|
|
return( $self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub cmp |
36
|
|
|
|
|
|
|
{ |
37
|
0
|
|
|
0
|
1
|
|
my( $self, $this ) = @_; |
38
|
0
|
0
|
|
|
|
|
return( $self->_is_a( $this => 'HTML::Object::Root' ) ? 0 : 1 ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
0
|
1
|
|
sub getAttributes { return( wantarray() ? () : [] ); } |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
sub getChildNodes { return( shift->root ); } |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
sub getName { return; } |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
sub getNextSibling { return; } |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
|
sub getParentNode { return; } |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
sub getPreviousSibling { return; } |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
1
|
|
sub getRootNode { return( shift( @_ ) ); } |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
sub is_inside { return( 0 ); } |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub isDocumentNode { return( 1 ); } |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
0
|
1
|
|
sub root { return( shift->_set_get_object( 'root', 'HTML::Object::DOM::Node', @_ ) ); } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
# NOTE: POD |
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding utf-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
HTML::Object::DOM::Root - HTML Object |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use HTML::Object::DOM::Root; |
74
|
|
|
|
|
|
|
my $this = HTML::Object::DOM::Root->new || die( HTML::Object::DOM::Root->error, "\n" ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
v0.2.0 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This module implements a Root in DOM. It inherits from L<HTML::Object::Root> and L<HTML::Object::DOM::Node> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 INHERITANCE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
+---------------------------+ +-------------------------+ +--------------------+ +-------------------------+ |
87
|
|
|
|
|
|
|
| HTML::Object::Element | --> | HTML::Object::Document | --> | HTML::Object::Root | --> | HTML::Object::DOM::Root | |
88
|
|
|
|
|
|
|
+---------------------------+ +-------------------------+ +--------------------+ +-------------------------+ |
89
|
|
|
|
|
|
|
| ^ |
90
|
|
|
|
|
|
|
| | |
91
|
|
|
|
|
|
|
v | |
92
|
|
|
|
|
|
|
+---------------------------+ +-------------------------+ | |
93
|
|
|
|
|
|
|
| HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | ---------------------------------+ |
94
|
|
|
|
|
|
|
+---------------------------+ +-------------------------+ |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 cmp |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Provided with another object and this returns true if the other object is a L<HTML::Object::Root> object or false otherwise. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 getAttributes |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Returns an empty list in list context, or an empty array reference in scalar context. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 getChildNodes |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns the L</root> element. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 getName |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 getNextSibling |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 getParentNode |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 getPreviousSibling |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns an empty list in list context, or C<undef> in scalar context. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 getRootNode |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 is_inside |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns false. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 isDocumentNode |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns true. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 root |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Sets or gets a L<root node|HTML::Object::DOM::Node>, which should be a L<HTML::Object::DOM::Element::HTML> object. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 AUTHOR |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SEE ALSO |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L<HTML::Object::DOM::Element::HTML> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Copyright(c) 2021 DEGUEST Pte. Ltd. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
All rights reserved |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |