| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||