DOM/LibXML/XPathContext.pm

filter: Statementstmt 66.6% 26 / 39 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod 100% 3 / 3 totaltotal 58.3% 35 / 60 CC 4 SCAR 11.6
CC
4
Cov
58%
BUILDARGS
6.0
findnodes
6.0
findvalue
6.0
CRAP 3.2
« DOM/LibXML.pm ↑ Summary DOM/Meta/LibXML.pm »
1 # $Id: /mirror/coderepos/lang/perl/MooseX-DOM/trunk/lib/MooseX/DOM/LibXML/XPathContext.pm 89522 2008-10-28T01:36:10.445014Z daisuke $
2  
3 package MooseX::DOM::LibXML::XPathContext;
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use XML::LibXML::XPathContext;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 class_type 'XML::LibXML::Document';
10 2 class_type 'XML::LibXML::Element';
11 coerce 'MooseX::DOM::LibXML::XPathContext'
12 => from 'XML::LibXML::Document'
13 0 ▶ => via { MooseX::DOM::LibXML::XPathContext->new($_->getDocumentElement) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 2 ;
15 coerce 'MooseX::DOM::LibXML::XPathContext'
16 => from 'XML::LibXML::Element'
17 0 ▶ => via { MooseX::DOM::LibXML::XPathContext->new($_) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
18 2 ;
19  
20 has 'node' => (
21 is => 'rw',
22 isa => 'XML::LibXML::Node',
23 required => 1,
24 0 ▶ trigger => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 my ($self, $value) = @_;
26 0 $self->xpathcontext(
27 XML::LibXML::XPathContext->new($value)
28 );
29 },
30 2 handles => [ qw(firstChild textContent toString) ],
31 );
32
33 2 has 'xpathcontext' => (
34 is => 'rw',
35 isa => 'XML::LibXML::XPathContext',
36 );
37
38 2 __PACKAGE__->meta->make_immutable;
39  
40 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 2 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 0 ▶sub BUILDARGS {
Subroutine BUILDARGS: not called CC=2 SCAR=17.9
Pod documented
44 0 my $class = shift;
45 0 ▶ my %args = scalar(@_) == 1 ? (node => $_[0]) : @_;
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ == 1 ? : 0 0 0
46 0 return \%args;
47 }
48  
49 0 ▶sub findnodes {
Subroutine findnodes: not called CC=2 SCAR=17.9
Pod documented
50 0 my ($self, $xpath) = @_;
51 0 ▶ Carp::confess "no xpath specified to findnodes" unless $xpath;
Branch: 1 branch
BranchTrueFalseTotal
unless $xpath 0 0 0
52 0 $self->xpathcontext->findnodes($xpath);
53 }
54  
55 0 ▶sub findvalue {
Subroutine findvalue: not called CC=2 SCAR=17.9
Pod documented
56 0 my ($self, $xpath) = @_;
57 0 ▶ Carp::confess "no xpath specified to findvalue" unless $xpath;
Branch: 1 branch
BranchTrueFalseTotal
unless $xpath 0 0 0
58 0 $self->xpathcontext->findvalue($xpath);
59 }
60  
61 2 1;
62  
63 __END__
« DOM/LibXML.pm ↑ Summary DOM/Meta/LibXML.pm »