line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## HTML Object - ~/lib/HTML/Object/Space.pm |
3
|
|
|
|
|
|
|
## Version v0.2.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2021 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2021/04/19 |
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::Space; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
29
|
|
|
29
|
|
211
|
use strict; |
|
29
|
|
|
|
|
53
|
|
|
29
|
|
|
|
|
843
|
|
18
|
29
|
|
|
29
|
|
146
|
use warnings; |
|
29
|
|
|
|
|
45
|
|
|
29
|
|
|
|
|
703
|
|
19
|
29
|
|
|
29
|
|
134
|
use warnings::register; |
|
29
|
|
|
|
|
58
|
|
|
29
|
|
|
|
|
2649
|
|
20
|
29
|
|
|
29
|
|
151
|
use parent qw( HTML::Object::Element ); |
|
29
|
|
|
|
|
45
|
|
|
29
|
|
|
|
|
130
|
|
21
|
29
|
|
|
29
|
|
1663
|
use vars qw( $VERSION ); |
|
29
|
|
|
|
|
47
|
|
|
29
|
|
|
|
|
1149
|
|
22
|
29
|
|
|
29
|
|
474
|
our $VERSION = 'v0.2.0'; |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
29
|
|
|
29
|
|
127
|
use strict; |
|
29
|
|
|
|
|
44
|
|
|
29
|
|
|
|
|
480
|
|
26
|
29
|
|
|
29
|
|
116
|
use warnings; |
|
29
|
|
|
|
|
55
|
|
|
29
|
|
|
|
|
5885
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub init |
29
|
|
|
|
|
|
|
{ |
30
|
370
|
|
|
370
|
1
|
4273
|
my $self = shift( @_ ); |
31
|
370
|
|
|
|
|
1460
|
$self->{is_empty} = 1; |
32
|
370
|
|
|
|
|
1168
|
$self->{tag} = '_space'; |
33
|
370
|
|
|
|
|
1140
|
$self->{value} = undef; |
34
|
370
|
|
|
|
|
1386
|
$self->{_init_strict_use_sub} = 1; |
35
|
370
|
|
|
|
|
1037
|
$self->{_exception_class} = 'HTML::Object::Exception'; |
36
|
370
|
50
|
|
|
|
2391
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
37
|
370
|
|
|
|
|
2329
|
return( $self ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub as_string |
41
|
|
|
|
|
|
|
{ |
42
|
38
|
|
|
38
|
1
|
100
|
my $self = shift( @_ ); |
43
|
|
|
|
|
|
|
# We need to remove the reset flag, otherwise if there are any subsequent change that need to be propagated to this space parent, HTML::Object::Element::reset will not propagate it |
44
|
38
|
|
|
|
|
186
|
$self->_remove_reset; |
45
|
38
|
50
|
|
|
|
139
|
return( $self->value->length ? $self->value : $self->original ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
0
|
sub as_xml { return( shift->as_string( @_ ) ); } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub set_checksum |
51
|
|
|
|
|
|
|
{ |
52
|
370
|
|
|
370
|
1
|
1445
|
my $self = shift( @_ ); |
53
|
370
|
|
|
|
|
1630
|
return( $self->_get_md5_hash( $self->value->scalar ) ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
816
|
|
|
816
|
1
|
8973800
|
sub value : lvalue { return( shift->_set_get_scalar_as_object( 'value', @_ ) ); } |
57
|
|
|
|
|
|
|
# { |
58
|
|
|
|
|
|
|
# my $self = shift( @_ ); |
59
|
|
|
|
|
|
|
# if( @_ ) |
60
|
|
|
|
|
|
|
# { |
61
|
|
|
|
|
|
|
# return( $self->_set_get_scalar_as_object( 'value', @_ ) ); |
62
|
|
|
|
|
|
|
# } |
63
|
|
|
|
|
|
|
# my $val = $self->_set_get_scalar_as_object( 'value' ); |
64
|
|
|
|
|
|
|
# return( $val ) if( defined( $val ) && $val->defined ); |
65
|
|
|
|
|
|
|
# return( $self->original ); |
66
|
|
|
|
|
|
|
# } |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
# NOTE: POD |
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding utf-8 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
HTML::Object::Space - HTML Object |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use HTML::Object::Space; |
81
|
|
|
|
|
|
|
my $sp = HTML::Object::Space->new || |
82
|
|
|
|
|
|
|
die( HTML::Object::Space->error, "\n" ); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
v0.2.0 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This module represents or or more spaces. It is used to capture spaces between L<HTML elements|HTML::Object::Element> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 INHERITANCE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
+-----------------------+ +---------------------+ |
95
|
|
|
|
|
|
|
| HTML::Object::Element | --> | HTML::Object::Space | |
96
|
|
|
|
|
|
|
+-----------------------+ +---------------------+ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 PROPERTIES |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 nodeValue |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This returns or sets the value of the current node. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
For document, element or collection, this returns C<undef> and for attribute, text or comment, this returns the objct value. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 METHODS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 as_string |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Returns the space value enclosed. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 as_xml |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is an alias for L</as_string> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 isEqualNode |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns a boolean value which indicates whether or not two elements are of the same type and all their defining data points match. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Two elements are equal when they have the same type, defining characteristics (this would be their ID, number of children, and so forth), its attributes match, and so on. The specific set of data points that must match varies depending on the types of the elements. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 nodeValue |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This returns or sets the value of the current element. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 set_checksum |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Read-only method. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This returns the md5 checksum for the current value. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 value |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Returns the current value as a L<scalar object|Module::Generic::Scalar> |
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>, 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> |
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 |