line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Acid::Buffer; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
26887
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
309
|
|
4
|
9
|
|
|
9
|
|
49
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
1330
|
|
5
|
9
|
|
|
9
|
|
49
|
use Carp; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
615
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
18006
|
use version; our $VERSION = qv('0.0.3'); |
|
9
|
|
|
|
|
31447
|
|
|
9
|
|
|
|
|
126
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Module implementation here |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
2614
|
|
|
2614
|
1
|
11840
|
my $class = shift; |
13
|
2614
|
|
|
|
|
4343
|
my $self = {}; |
14
|
2614
|
|
100
|
|
|
10471
|
$self->{tagname} = shift || ''; |
15
|
2614
|
|
|
|
|
4610
|
$self->{text} = ""; |
16
|
2614
|
|
|
|
|
8332
|
$self->{attr} = {}; |
17
|
2614
|
|
|
|
|
7900
|
bless $self, $class; |
18
|
2614
|
|
|
|
|
7059
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_attr { |
22
|
1088
|
|
|
1088
|
1
|
1374
|
my $self = shift; |
23
|
1088
|
|
|
|
|
6313
|
return $self->{attr}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub set_attr { |
27
|
2110
|
|
|
2110
|
1
|
3822
|
my $self = shift; |
28
|
2110
|
|
|
|
|
2482
|
my $attr = shift; |
29
|
2110
|
|
|
|
|
5974
|
$self->{attr} = $attr; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub state { |
33
|
2319
|
|
|
2319
|
1
|
4495
|
my $self = shift; |
34
|
2319
|
|
|
|
|
10579
|
return $self->{text}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add { |
38
|
11503
|
|
|
11503
|
1
|
49564
|
my $self = shift; |
39
|
11503
|
|
|
|
|
40015
|
$self->{text} .= shift; |
40
|
11503
|
|
|
|
|
34282
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub stop { |
44
|
2504
|
|
|
2504
|
1
|
8506
|
my $self = shift; |
45
|
2504
|
|
|
|
|
3877
|
my $tagname = $self->{tagname}; |
46
|
2504
|
100
|
|
|
|
9458
|
my $results = $tagname ? "<$tagname" : ''; |
47
|
2504
|
|
|
|
|
4030
|
my $text = $self->{text}; |
48
|
2504
|
|
|
|
|
11907
|
foreach my $key (sort keys %{$self->{attr}}) { |
|
2504
|
|
|
|
|
12696
|
|
49
|
1270
|
|
|
|
|
4253
|
$results .= " $key=\"$self->{attr}->{$key}\""; |
50
|
|
|
|
|
|
|
} |
51
|
2504
|
100
|
|
|
|
11997
|
$results .= ($tagname ? ">$text$tagname>" : $text); |
52
|
2504
|
|
|
|
|
6399
|
delete $self->{text}; |
53
|
2504
|
|
|
|
|
5640
|
delete $self->{attr}; |
54
|
2504
|
|
|
|
|
16487
|
return $results; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
58
|
|
|
|
|
|
|
__END__ |