| 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 | 77 | ▶ | use XML::LibXML::Boolean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 77 | ▶ | use XML::LibXML::Number; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 77 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 77 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 77 | our $VERSION = "2.0213"; # VERSION TEMPLATE: DO NOT CHANGE | |||||||||
| 19 | |||||||||||
| 20 | use overload | ||||||||||
| 21 | 77 | ▶ | '""' => \&value, | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 77 | 'cmp' => \&cmp; | |||||||||
| 23 | |||||||||||
| 24 | 84 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 25 | 84 | my $class = shift; | |||||||||
| 26 | 84 | my ($string) = @_; | |||||||||
| 27 | |||||||||||
| 28 | # $string =~ s/"/"/g; | ||||||||||
| 29 | # $string =~ s/'/'/g; | ||||||||||
| 30 | |||||||||||
| 31 | 84 | bless \$string, $class; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | 0 | my $self = shift; | |||||||||
| 36 | 0 | my $string = $$self; | |||||||||
| 37 | 0 | $string =~ s/'/'/g; | |||||||||
| 38 | 0 | return "'$string'"; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub as_xml { | ||||||||
|
Subroutine
as_xml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 42 | 0 | my $self = shift; | |||||||||
| 43 | 0 | my $string = $$self; | |||||||||
| 44 | 0 | return "<Literal>$string</Literal>\n"; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 78 | ▶ | sub value { | ||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 48 | 78 | my $self = shift; | |||||||||
| 49 | 78 | $$self; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 6 | ▶ | sub cmp { | ||||||||
|
Subroutine
cmp: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | 6 | my $self = shift; | |||||||||
| 54 | 6 | my ($cmp, $swap) = @_; | |||||||||
| 55 | 6 | ▶ | if ($swap) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 1 | return $cmp cmp $$self; | |||||||||
| 57 | } | ||||||||||
| 58 | 5 | return $$self cmp $cmp; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub evaluate { | ||||||||
|
Subroutine
evaluate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 62 | 0 | my $self = shift; | |||||||||
| 63 | 0 | $self; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 0 | ▶ | sub to_boolean { | ||||||||
|
Subroutine
to_boolean: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 67 | 0 | my $self = shift; | |||||||||
| 68 | 0 | ▶ | return (length($$self) > 0) ? XML::LibXML::Boolean->True : XML::LibXML::Boolean->False; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | sub to_number { return XML::LibXML::Number->new($_[0]->value); } | ||||||||
|
Subroutine
to_number: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 72 | 7 | ▶ | sub to_literal { return $_[0]; } | ||||||||
|
Subroutine
to_literal: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 73 | |||||||||||
| 74 | 2 | ▶ | sub string_value { return $_[0]->value; } | ||||||||
|
Subroutine
string_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 75 | |||||||||||
| 76 | 77 | 1; | |||||||||
| 77 | __END__ | ||||||||||