blib/lib/HTML/Selector/XPath/Simple.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 100% 40 / 40 CC 2 SCAR 2.0
CC
2
Cov
100%
select
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package HTML::Selector::XPath::Simple;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use version; our $VERSION = qv('0.0.3');
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use HTML::Selector::XPath;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use HTML::TreeBuilder::XPath;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
13 1 my $class = shift;
14 1 bless {
15 tree => HTML::TreeBuilder::XPath->new->parse( shift )->eof,
16 }, $class;
17 }
18  
19 5 ▶sub select {
Subroutine select: called CC=2 SCAR=6.9
Pod documented
20 5 my $self = shift;
21 5 my $xpath = HTML::Selector::XPath->new( shift )->to_xpath;
22 9 my @results = map { @{ $_->content } }
23 5 $self->{tree}->findnodes($xpath);
24 5 ▶ return wantarray ? @results : $results[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 3 5
25 }
26  
27 3 1; # Magic true value required at end of module
28 __END__
↑ Summary