| 1 | # $Id$ | ||||||||||
| 2 | # | ||||||||||
| 3 | # This is free software, you may use it and distribute it under the same terms as | ||||||||||
| 4 | # Perl itself. | ||||||||||
| 5 | # | ||||||||||
| 6 | # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas | ||||||||||
| 7 | # | ||||||||||
| 8 | # | ||||||||||
| 9 | |||||||||||
| 10 | package XML::LibXML::Literal; | ||||||||||
| 11 | |||||||||||
| 12 | 69 | ▶ | use XML::LibXML::Boolean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 69 | ▶ | use XML::LibXML::Number; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 69 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 69 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 69 | ▶ | use vars qw ($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 69 | $VERSION = "2.0210"; # VERSION TEMPLATE: DO NOT CHANGE | |||||||||
| 20 | |||||||||||
| 21 | use overload | ||||||||||
| 22 | 69 | '""' => \&value, | |||||||||
| 23 | 69 | ▶ | 'cmp' => \&cmp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | sub new { | ||||||||||
| 26 | 75 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 27 | 75 | my ($string) = @_; | |||||||||
| 28 | |||||||||||
| 29 | # $string =~ s/"/"/g; | ||||||||||
| 30 | # $string =~ s/'/'/g; | ||||||||||
| 31 | |||||||||||
| 32 | 75 | bless \$string, $class; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | sub as_string { | ||||||||||
| 36 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | 0 | my $string = $$self; | |||||||||
| 38 | 0 | $string =~ s/'/'/g; | |||||||||
| 39 | 0 | return "'$string'"; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | sub as_xml { | ||||||||||
| 43 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
as_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 44 | 0 | my $string = $$self; | |||||||||
| 45 | 0 | return "<Literal>$string</Literal>\n"; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | sub value { | ||||||||||
| 49 | 69 | ▶ | my $self = shift; | ||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 50 | 69 | $$self; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | sub cmp { | ||||||||||
| 54 | 6 | ▶ | my $self = shift; | ||||||||
|
Subroutine
cmp: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 55 | 6 | my ($cmp, $swap) = @_; | |||||||||
| 56 | 6 | ▶ | if ($swap) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 1 | return $cmp cmp $$self; | |||||||||
| 58 | } | ||||||||||
| 59 | 5 | return $$self cmp $cmp; | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | sub evaluate { | ||||||||||
| 63 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
evaluate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 64 | 0 | $self; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | sub to_boolean { | ||||||||||
| 68 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
to_boolean: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 69 | 0 | ▶ | return (length($$self) > 0) ? XML::LibXML::Boolean->True : XML::LibXML::Boolean->False; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 0 | ▶ | sub to_number { return XML::LibXML::Number->new($_[0]->value); } | ||||||||
|
Subroutine
to_number: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 73 | 7 | ▶ | sub to_literal { return $_[0]; } | ||||||||
|
Subroutine
to_literal: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 74 | |||||||||||
| 75 | 2 | ▶ | sub string_value { return $_[0]->value; } | ||||||||
|
Subroutine
string_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 76 | |||||||||||
| 77 | 69 | 1; | |||||||||
| 78 | __END__ | ||||||||||