line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## HTML Object - ~/lib/HTML/Object/Root.pm |
3
|
|
|
|
|
|
|
## Version v0.2.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2021 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2021/04/22 |
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::Root; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
4
|
|
|
4
|
|
1506
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
120
|
|
18
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
117
|
|
19
|
4
|
|
|
4
|
|
19
|
use parent qw( HTML::Object::Document ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
21
|
|
20
|
4
|
|
|
4
|
|
276
|
use vars qw( $VERSION ); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
177
|
|
21
|
4
|
|
|
4
|
|
95
|
our $VERSION = 'v0.2.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
4
|
|
28
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
79
|
|
25
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
596
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
1
|
|
my $self = shift( @_ ); |
30
|
0
|
|
|
|
|
|
$self->{root} = ''; |
31
|
0
|
|
|
|
|
|
$self->{_init_strict_use_sub} = 1; |
32
|
0
|
|
|
|
|
|
$self->{_exception_class} = 'HTML::Object::Exception'; |
33
|
0
|
0
|
|
|
|
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
34
|
0
|
|
|
|
|
|
return( $self ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# added to provide element-like methods to root, for use by cmp |
38
|
|
|
|
|
|
|
sub lineage |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
0
|
1
|
|
my $self = shift( @_ ); |
41
|
0
|
|
|
|
|
|
return( $self->new_array( [ $self ] ) ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub root { return( shift->_set_get_object( 'root', 'HTML::Object::Element', @_ ) ); } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
# NOTE: POD |
48
|
|
|
|
|
|
|
__END__ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding utf-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
HTML::Object::Root - HTML Object |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use HTML::Object::Root; |
59
|
|
|
|
|
|
|
my $root = HTML::Object::Root->new || |
60
|
|
|
|
|
|
|
die( HTML::Object::Root->error, "\n" ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
v0.2.0 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This module represent a C<Root> element. It inherits fron L<HTML::Object::Document> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 INHERITANCE |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
+-----------------------+ +------------------------+ +--------------------+ |
73
|
|
|
|
|
|
|
| HTML::Object::Element | --> | HTML::Object::Document | --> | HTML::Object::Root | |
74
|
|
|
|
|
|
|
+-----------------------+ +------------------------+ +--------------------+ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 PROPERTIES |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 nodeValue |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This returns or sets the value of the current node. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
For document, element or collection, this returns C<undef> and for attribute, text or comment, this returns the objct value. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 METHODS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 cmp |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Provided with an element and this returns true if this element is a L<Root element|HTML::Object::Root>, or false otherwise. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 getAttributes |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Returns a new empty L<array object|Module::Generic::Array> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 getChildNodes |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns the value returned by L</root> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 getName |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns C<undef> if scalar context and an empty list in list context. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 getNextSibling |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns C<undef> if scalar context and an empty list in list context. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 getParentNode |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Returns C<undef> if scalar context and an empty list in list context. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 getPreviousSibling |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns C<undef> if scalar context and an empty list in list context. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 getRootNode |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns the current object since there is no higher element than itself. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 is_inside |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns C<0>, i.e. false. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 isDocumentNode |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Returns C<1>, i.e. true. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 lineage |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Returns a new L<array object|Module::Generic::Array> with the current object as its sole element. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 root |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Returns the L<element object|HTML::Object::Element> representing the actual root element. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 SEE ALSO |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
L<HTML::Object>, L<HTML::Object::Attribute>, L<HTML::Object::Boolean>, L<HTML::Object::Closing>, L<HTML::Object::Collection>, L<HTML::Object::Comment>, L<HTML::Object::Declaration>, L<HTML::Object::Document>, L<HTML::Object::Element>, L<HTML::Object::Exception>, L<HTML::Object::Literal>, L<HTML::Object::Number>, L<HTML::Object::Root>, L<HTML::Object::Space>, L<HTML::Object::Text>, L<HTML::Object::XQuery> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Copyright (c) 2021 DEGUEST Pte. Ltd. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
All rights reserved |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |