line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Element::Replacer; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
132866
|
use HTML::TreeBuilder; |
|
2
|
|
|
|
|
44540
|
|
|
2
|
|
|
|
|
26
|
|
4
|
2
|
|
|
2
|
|
2657
|
use HTML::Element::Library; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Moose; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'tree' => ( is => 'rw', required => 1 ) ; |
9
|
|
|
|
|
|
|
has 'elem' => ( is => 'rw', lazy => 1, default => sub { $_[0]->tree->look_down(@{$_[0]->look_down}) } ) ; |
10
|
|
|
|
|
|
|
has 'elem_clone' => ( is => 'rw' ) ; |
11
|
|
|
|
|
|
|
has 'look_down' => ( is => 'rw', required => 1 ) ; |
12
|
|
|
|
|
|
|
has 'replacements' => ( is => 'rw', isa => 'ArrayRef') ; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub BUILD { |
18
|
|
|
|
|
|
|
my($self)=@_; |
19
|
|
|
|
|
|
|
$self->replacements([]); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub DESTROY { |
23
|
|
|
|
|
|
|
my($self)=@_; |
24
|
|
|
|
|
|
|
$self->elem->replace_with( @ { $self->replacements } ) ; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub push_clone { |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my($self)=@_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $clone = $self->elem->clone; |
32
|
|
|
|
|
|
|
push @{$self->replacements}, $clone; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$clone; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; # End of HTML::Element::Replacer |