TPath/Function.pm

filter: Statementstmt 50.0% 9 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 1 / 3 Podpod 0.0% 0 / 1 totaltotal 41.6% 10 / 24 CC 2 SCAR 13.2
CC
2
Cov
45%
to_string
6.0
to_num
2.0
BEGIN
1.0
CRAP 3.8
« TPath/Test/Node/Attribute.pm ↑ Summary TPath/Context.pm »
1 package TPath::Function;
2 1 $TPath::Function::VERSION = '1.007';
3 # ABSTRACT: implements the functions in expressions such as C<//*[:abs(@foo) = 1]> and C<//*[:sqrt(@bar) == 2]>
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 with 'TPath::Numifiable';
8  
9 1 has f => ( is => 'ro', isa => 'CodeRef', required => 1 );
10  
11 1 has name => ( is => 'ro', isa => 'Str', required => 1 );
12  
13 1 has arg => ( is => 'ro', isa => 'TPath::Numifiable', required => 1 );
14  
15 0 ▶sub to_num {
Subroutine to_num: not called CC=1 SCAR=6.9
16 0 my ( $self, $ctx ) = @_;
17 0 return $self->f->( $self->arg->to_num($ctx) );
18 }
19  
20 0 ▶sub to_string {
Subroutine to_string: not called CC=2 SCAR=17.9
Pod undocumented
21 0 my $self = shift;
22 0 my $s = ':' . $self->name . '(';
23 0 ▶ if ( $self->arg->isa('TPath::Math') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->arg->isa('TPath::Math')) { } 0 0 0
24 0 $s .= ' ' . $self->arg->to_string(1) . ' ';
25 }
26 else {
27 0 $s .= $self->arg->to_string(1);
28 }
29 0 $s .= ')';
30 0 return $s;
31 }
32  
33 1 1;
34  
35 __END__
« TPath/Test/Node/Attribute.pm ↑ Summary TPath/Context.pm »