XPathEngine/Literal.pm

filter: Statementstmt 78.3% 29 / 37 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 12 / 14 Podpod 100% 10 / 10 totaltotal 83.0% 54 / 65 CC 3 SCAR 3.3
CC
3
Cov
78%
xpath_cmp
2.1
as_string
2.0
as_xml
2.0
CRAP 1.4
« XPathEngine/Root.pm ↑ Summary
1 # $Id: /tree-xpathengine/trunk/lib/Tree/XPathEngine/Literal.pm 17 2006-02-12T08:00:01.814064Z mrodrigu $
2  
3 package Tree::XPathEngine::Literal;
4 6 ▶use Tree::XPathEngine::Boolean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Tree::XPathEngine::Number;
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 'cmp' => \&xpath_cmp;
11  
12 347 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
13 347 my $class = shift;
14 347 my ($string) = @_;
15
16 # $string =~ s/"/"/g;
17 # $string =~ s/'/'/g;
18
19 347 bless \$string, $class;
20 }
21  
22 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
23 0 my $self = shift;
24 0 my $string = $$self;
25 0 $string =~ s/'/'/g;
26 0 return "'$string'";
27 }
28  
29 0 ▶sub as_xml {
Subroutine as_xml: not called CC=1 SCAR=6.9
Pod documented
30 0 my $self = shift;
31 0 my $string = $$self;
32 0 return "<Literal>$string</Literal>\n";
33 }
34  
35 899 ▶sub value {
Subroutine value: called CC=1 SCAR=0.0
Pod documented
36 899 my $self = shift;
37 899 $$self;
38 }
39  
40 102 ▶sub xpath_cmp {
Subroutine xpath_cmp: called CC=2 SCAR=7.4
Pod documented
41 102 my $self = shift;
42 102 my ($cmp, $swap) = @_;
43 102 ▶ if ($swap) {
Branch: 1 branch
BranchTrueFalseTotal
if ($swap) 0 102 102
44 0 return $cmp cmp $$self;
45 }
46 102 return $$self cmp $cmp;
47 }
48  
49 521 ▶sub evaluate {
Subroutine evaluate: called CC=1 SCAR=0.0
Pod documented
50 521 my $self = shift;
51 521 $self;
52 }
53  
54 2 ▶sub xpath_to_boolean {
Subroutine xpath_to_boolean: called CC=2 SCAR=6.9
Pod documented
55 2 my $self = shift;
56 2 ▶ return (length($$self) > 0) ? Tree::XPathEngine::Boolean->_true : Tree::XPathEngine::Boolean->_false;
Branch: 1 branch
BranchTrueFalseTotal
length $$self > 0 ? : 1 1 2
57 }
58  
59 5 ▶sub xpath_to_number { return Tree::XPathEngine::Number->new($_[0]->value); }
Subroutine xpath_to_number: called CC=1 SCAR=0.0
Pod documented
60 59 ▶sub xpath_to_literal { return $_[0]; }
Subroutine xpath_to_literal: called CC=1 SCAR=0.0
Pod documented
61  
62 225 ▶sub xpath_string_value { return $_[0]->value; }
Subroutine xpath_string_value: called CC=1 SCAR=0.0
Pod documented
63  
64 6 1;
65 __END__
« XPathEngine/Root.pm ↑ Summary