line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::TokeParser::Simple::Token::Tag; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
29
|
use strict; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
248
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '3.16'; |
6
|
5
|
|
|
5
|
|
23
|
use base 'HTML::TokeParser::Simple::Token'; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
1627
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %INSTANCE; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
98
|
|
|
98
|
0
|
142
|
my ($class, $object) = @_; |
12
|
98
|
50
|
|
|
|
224
|
$class->_croak("This is a base class that should not be instantiated") |
13
|
|
|
|
|
|
|
if __PACKAGE__ eq $class; |
14
|
98
|
|
|
|
|
257
|
my $self = bless $object, $class; |
15
|
98
|
|
|
|
|
287
|
$self->_init; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
0
|
|
0
|
sub _get_attrseq { return [] } |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
0
|
sub _get_attr { return {} } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _set_text { |
23
|
24
|
|
|
24
|
|
30
|
my $self = shift; |
24
|
24
|
|
|
|
|
42
|
$self->[-1] = shift; |
25
|
24
|
|
|
|
|
50
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# attribute munging methods |
29
|
|
|
|
|
|
|
# get_foo methods |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub return_text { |
32
|
0
|
|
|
0
|
1
|
|
carp('return_text() is deprecated. Use as_is() instead'); |
33
|
0
|
|
|
|
|
|
goto &as_is; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub as_is { |
37
|
0
|
|
|
0
|
1
|
|
return shift->_get_text; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_tag { |
41
|
0
|
|
|
0
|
1
|
|
return shift->_get_tag; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
HTML::TokeParser::Simple::Token::Tag - Token.pm tag class. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use HTML::TokeParser::Simple; |
55
|
|
|
|
|
|
|
my $p = HTML::TokeParser::Simple->new( $somefile ); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
while ( my $token = $p->get_token ) { |
58
|
|
|
|
|
|
|
# This prints all text in an HTML doc (i.e., it strips the HTML) |
59
|
|
|
|
|
|
|
next unless $token->is_text; |
60
|
|
|
|
|
|
|
print $token->as_is; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is the base class for start and end tokens. It should not be |
66
|
|
|
|
|
|
|
instantiated. See C<HTML::TokeParser::Simple::Token::Tag::Start> and |
67
|
|
|
|
|
|
|
C<HTML::TokeParser::Simple::Token::Tag::End> for details. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 OVERRIDDEN METHODS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The following list of methods are provided by this class. See |
72
|
|
|
|
|
|
|
L<HTML::TokeParser::Simple> for descriptions of these methods. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * as_is |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * get_tag |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * return_text |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=back |