XPathEngine/Boolean.pm

filter: Statementstmt 80.0% 24 / 30 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 100% 6 / 6 totaltotal 78.8% 41 / 52 CC 3 SCAR 6.7
CC
3
Cov
74%
xpath_cmp
6.0
xpath_to_literal
2.1
xpath_string_value
2.0
CRAP 1.9
« XPathEngine/Number.pm ↑ Summary XPathEngine/NodeSet.pm »
1 # $Id: /tree-xpathengine/trunk/lib/Tree/XPathEngine/Boolean.pm 17 2006-02-12T08:00:01.814064Z mrodrigu $
2  
3 package Tree::XPathEngine::Boolean;
4 6 ▶use Tree::XPathEngine::Number;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Tree::XPathEngine::Literal;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 use overload
9 6 ▶ '""' => \&value,
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 '<=>' => \&xpath_cmp;
11  
12 290 ▶sub _true {
Subroutine _true: called CC=1 SCAR=0.0
13 290 my $class = shift;
14 290 my $val = 1;
15 290 bless \$val, $class;
16 }
17  
18 489 ▶sub _false {
Subroutine _false: called CC=1 SCAR=0.0
19 489 my $class = shift;
20 489 my $val = 0;
21 489 bless \$val, $class;
22 }
23  
24 797 ▶sub value {
Subroutine value: called CC=1 SCAR=0.0
Pod documented
25 797 my $self = shift;
26 797 $$self;
27 }
28  
29 0 ▶sub xpath_cmp {
Subroutine xpath_cmp: not called CC=2 SCAR=17.9
Pod documented
30 0 my $self = shift;
31 0 my ($other, $swap) = @_;
32 0 ▶ if ($swap) {
Branch: 1 branch
BranchTrueFalseTotal
if ($swap) 0 0 0
33 0 return $other <=> $$self;
34 }
35 0 return $$self <=> $other;
36 }
37  
38 8 ▶sub xpath_to_number { Tree::XPathEngine::Number->new($_[0]->value); }
Subroutine xpath_to_number: called CC=1 SCAR=0.0
Pod documented
39 47 ▶sub xpath_to_boolean { $_[0]; }
Subroutine xpath_to_boolean: called CC=1 SCAR=0.0
Pod documented
40 18 ▶sub xpath_to_literal { Tree::XPathEngine::Literal->new($_[0]->value ? "true" : "false"); }
Subroutine xpath_to_literal: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->value ? : 18 0 18
41  
42 0 ▶sub xpath_string_value { return $_[0]->xpath_to_literal->value; }
Subroutine xpath_string_value: not called CC=1 SCAR=6.9
Pod documented
43  
44 6 1;
45 __END__
« XPathEngine/Number.pm ↑ Summary XPathEngine/NodeSet.pm »