blib/lib/HTML/Element/Replacer.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 94.5% 35 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package HTML::Element::Replacer;
2 # ABSTRACT: Simplify the HTML::Element clone() - push_content() ritual
3 2 ▶use HTML::TreeBuilder;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use HTML::Element::Library;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 has 'tree' => ( is => 'rw', required => 1 ) ;
9 1 ▶has 'elem' => ( is => 'rw', lazy => 1, default => sub { $_[0]->tree->look_down(@{$_[0]->look_down}) } ) ;
Subroutine __ANON__: called CC=1 SCAR=0.0
10 2 has 'elem_clone' => ( is => 'rw' ) ;
11 2 has 'look_down' => ( is => 'rw', required => 1 ) ;
12 2 has 'replacements' => ( is => 'rw', isa => 'ArrayRef') ;
13  
14 2 our $VERSION = '0.08';
15  
16 1 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
17 1 my($self)=@_;
18 1 $self->replacements([]);
19 }
20  
21 1 ▶sub DESTROY {
Subroutine DESTROY: called CC=1 SCAR=0.0
22 1 my($self)=@_;
23 1 $self->elem->replace_with( @ { $self->replacements } ) ;
24 }
25  
26 3 ▶sub push_clone {
Subroutine push_clone: called CC=1 SCAR=0.0
Pod undocumented
27  
28 3 my($self)=@_;
29  
30 3 my $clone = $self->elem->clone;
31 3 push @{$self->replacements}, $clone;
32  
33 3 $clone;
34 }
35  
36  
37 2 1; # End of HTML::Element::Replacer
↑ Summary