XPath/Literal.pm

filter: Statementstmt 41.4% 17 / 41 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 5 / 15 Podpod 30.0% 3 / 10 totaltotal 35.7% 25 / 70 CC 3 SCAR 9.7
CC
3
Cov
38%
cmp
6.0
to_boolean
6.0
new
2.0
CRAP 2.6
« XPath/Boolean.pm ↑ Summary XPath/Variable.pm »
1 package XML::XPath::Literal;
2  
3 1 $VERSION = '1.26';
4  
5 1 ▶use XML::XPath::Boolean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XML::XPath::Number;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 use overload
10 1 '""' => \&value,
11 1 ▶ 'cmp' => \&cmp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub new {
14 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
15 0 my ($string) = @_;
16  
17 # $string =~ s/"/"/g;
18 # $string =~ s/'/'/g;
19  
20 0 bless \$string, $class;
21 }
22  
23 sub as_string {
24 0 ▶ my $self = shift;
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
25 0 my $string = $$self;
26 0 $string =~ s/'/'/g;
27 0 return "'$string'";
28 }
29  
30 sub as_xml {
31 0 ▶ my $self = shift;
Subroutine as_xml: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my $string = $$self;
33 0 return "<Literal>$string</Literal>\n";
34 }
35  
36 sub value {
37 0 ▶ my $self = shift;
Subroutine value: not called CC=1 SCAR=6.9
Pod documented
38 0 $$self;
39 }
40  
41 sub cmp {
42 0 ▶ my $self = shift;
Subroutine cmp: not called CC=2 SCAR=17.9
Pod documented
43 0 my ($cmp, $swap) = @_;
44 0 ▶ if ($swap) {
Branch: 1 branch
BranchTrueFalseTotal
if ($swap) 0 0 0
45 0 return $cmp cmp $$self;
46 }
47 0 return $$self cmp $cmp;
48 }
49  
50 sub evaluate {
51 0 ▶ my $self = shift;
Subroutine evaluate: not called CC=1 SCAR=6.9
Pod undocumented
52 0 $self;
53 }
54  
55 sub to_boolean {
56 0 ▶ my $self = shift;
Subroutine to_boolean: not called CC=2 SCAR=17.9
Pod undocumented
57 0 ▶ return (length($$self) > 0) ? XML::XPath::Boolean->True : XML::XPath::Boolean->False;
Branch: 1 branch
BranchTrueFalseTotal
length $$self > 0 ? : 0 0 0
58 }
59  
60 0 ▶sub to_number { return XML::XPath::Number->new($_[0]->value); }
Subroutine to_number: not called CC=1 SCAR=6.9
Pod undocumented
61 0 ▶sub to_literal { return $_[0]; }
Subroutine to_literal: not called CC=1 SCAR=6.9
Pod undocumented
62  
63 0 ▶sub string_value { return $_[0]->value; }
Subroutine string_value: not called CC=1 SCAR=6.9
Pod undocumented
64  
65 1 1;
66 __END__
« XPath/Boolean.pm ↑ Summary XPath/Variable.pm »