| Filename | /usr/lib64/perl5/vendor_perl/5.16.0/x86_64-linux/XML/LibXML/Literal.pm |
| Statements | Executed 12 statements in 2.58ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 101µs | 304µs | XML::LibXML::Literal::BEGIN@19 |
| 1 | 1 | 1 | 68µs | 68µs | XML::LibXML::Literal::BEGIN@11 |
| 1 | 1 | 1 | 50µs | 147µs | XML::LibXML::Literal::BEGIN@13 |
| 1 | 1 | 1 | 50µs | 50µs | XML::LibXML::Literal::BEGIN@12 |
| 1 | 1 | 1 | 50µs | 196µs | XML::LibXML::Literal::BEGIN@15 |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::as_string |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::as_xml |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::cmp |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::evaluate |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::new |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::string_value |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::to_boolean |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::to_literal |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::to_number |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Literal::value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 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 | 2 | 190µs | 1 | 68µs | # spent 68µs within XML::LibXML::Literal::BEGIN@11 which was called:
# once (68µs+0s) by XML::LibXML::Number::BEGIN@12 at line 11 # spent 68µs making 1 call to XML::LibXML::Literal::BEGIN@11 |
| 12 | 2 | 156µs | 1 | 50µs | # spent 50µs within XML::LibXML::Literal::BEGIN@12 which was called:
# once (50µs+0s) by XML::LibXML::Number::BEGIN@12 at line 12 # spent 50µs making 1 call to XML::LibXML::Literal::BEGIN@12 |
| 13 | 2 | 160µs | 2 | 243µs | # spent 147µs (50+96) within XML::LibXML::Literal::BEGIN@13 which was called:
# once (50µs+96µs) by XML::LibXML::Number::BEGIN@12 at line 13 # spent 147µs making 1 call to XML::LibXML::Literal::BEGIN@13
# spent 96µs making 1 call to strict::import |
| 14 | |||||
| 15 | 2 | 289µs | 2 | 343µs | # spent 196µs (50+147) within XML::LibXML::Literal::BEGIN@15 which was called:
# once (50µs+147µs) by XML::LibXML::Number::BEGIN@12 at line 15 # spent 196µs making 1 call to XML::LibXML::Literal::BEGIN@15
# spent 147µs making 1 call to vars::import |
| 16 | 1 | 4µs | $VERSION = "1.90"; # VERSION TEMPLATE: DO NOT CHANGE | ||
| 17 | |||||
| 18 | use overload | ||||
| 19 | 1 | 86µs | 1 | 203µs | # spent 304µs (101+203) within XML::LibXML::Literal::BEGIN@19 which was called:
# once (101µs+203µs) by XML::LibXML::Number::BEGIN@12 at line 20 # spent 203µs making 1 call to overload::import |
| 20 | 1 | 1.68ms | 1 | 304µs | 'cmp' => \&cmp; # spent 304µs making 1 call to XML::LibXML::Literal::BEGIN@19 |
| 21 | |||||
| 22 | sub new { | ||||
| 23 | my $class = shift; | ||||
| 24 | my ($string) = @_; | ||||
| 25 | |||||
| 26 | # $string =~ s/"/"/g; | ||||
| 27 | # $string =~ s/'/'/g; | ||||
| 28 | |||||
| 29 | bless \$string, $class; | ||||
| 30 | } | ||||
| 31 | |||||
| 32 | sub as_string { | ||||
| 33 | my $self = shift; | ||||
| 34 | my $string = $$self; | ||||
| 35 | $string =~ s/'/'/g; | ||||
| 36 | return "'$string'"; | ||||
| 37 | } | ||||
| 38 | |||||
| 39 | sub as_xml { | ||||
| 40 | my $self = shift; | ||||
| 41 | my $string = $$self; | ||||
| 42 | return "<Literal>$string</Literal>\n"; | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | sub value { | ||||
| 46 | my $self = shift; | ||||
| 47 | $$self; | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | sub cmp { | ||||
| 51 | my $self = shift; | ||||
| 52 | my ($cmp, $swap) = @_; | ||||
| 53 | if ($swap) { | ||||
| 54 | return $cmp cmp $$self; | ||||
| 55 | } | ||||
| 56 | return $$self cmp $cmp; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | sub evaluate { | ||||
| 60 | my $self = shift; | ||||
| 61 | $self; | ||||
| 62 | } | ||||
| 63 | |||||
| 64 | sub to_boolean { | ||||
| 65 | my $self = shift; | ||||
| 66 | return (length($$self) > 0) ? XML::LibXML::Boolean->True : XML::LibXML::Boolean->False; | ||||
| 67 | } | ||||
| 68 | |||||
| 69 | sub to_number { return XML::LibXML::Number->new($_[0]->value); } | ||||
| 70 | sub to_literal { return $_[0]; } | ||||
| 71 | |||||
| 72 | sub string_value { return $_[0]->value; } | ||||
| 73 | |||||
| 74 | 1 | 14µs | 1; | ||
| 75 | __END__ |