| Filename | /usr/lib64/perl5/vendor_perl/5.16.0/x86_64-linux/XML/LibXML/Boolean.pm |
| Statements | Executed 12 statements in 2.69ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.99ms | 7.38ms | XML::LibXML::Boolean::BEGIN@12 |
| 1 | 1 | 1 | 116µs | 378µs | XML::LibXML::Boolean::BEGIN@21 |
| 1 | 1 | 1 | 50µs | 189µs | XML::LibXML::Boolean::BEGIN@16 |
| 1 | 1 | 1 | 49µs | 143µs | XML::LibXML::Boolean::BEGIN@14 |
| 1 | 1 | 1 | 38µs | 38µs | XML::LibXML::Boolean::BEGIN@13 |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::False |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::True |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::cmp |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::new |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::string_value |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::to_boolean |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::to_literal |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::to_number |
| 0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # $Id$ | ||||
| 2 | # | ||||
| 3 | # | ||||
| 4 | # This is free software, you may use it and distribute it under the same terms as | ||||
| 5 | # Perl itself. | ||||
| 6 | # | ||||
| 7 | # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas | ||||
| 8 | # | ||||
| 9 | # | ||||
| 10 | |||||
| 11 | package XML::LibXML::Boolean; | ||||
| 12 | 2 | 555µs | 1 | 7.38ms | # spent 7.38ms (2.99+4.39) within XML::LibXML::Boolean::BEGIN@12 which was called:
# once (2.99ms+4.39ms) by XML::LibXML::NodeList::BEGIN@15 at line 12 # spent 7.38ms making 1 call to XML::LibXML::Boolean::BEGIN@12 |
| 13 | 2 | 138µs | 1 | 38µs | # spent 38µs within XML::LibXML::Boolean::BEGIN@13 which was called:
# once (38µs+0s) by XML::LibXML::NodeList::BEGIN@15 at line 13 # spent 38µs making 1 call to XML::LibXML::Boolean::BEGIN@13 |
| 14 | 2 | 156µs | 2 | 237µs | # spent 143µs (49+94) within XML::LibXML::Boolean::BEGIN@14 which was called:
# once (49µs+94µs) by XML::LibXML::NodeList::BEGIN@15 at line 14 # spent 143µs making 1 call to XML::LibXML::Boolean::BEGIN@14
# spent 94µs making 1 call to strict::import |
| 15 | |||||
| 16 | 2 | 282µs | 2 | 329µs | # spent 189µs (50+140) within XML::LibXML::Boolean::BEGIN@16 which was called:
# once (50µs+140µs) by XML::LibXML::NodeList::BEGIN@15 at line 16 # spent 189µs making 1 call to XML::LibXML::Boolean::BEGIN@16
# spent 140µs making 1 call to vars::import |
| 17 | |||||
| 18 | 1 | 4µs | $VERSION = "1.90"; # VERSION TEMPLATE: DO NOT CHANGE | ||
| 19 | |||||
| 20 | use overload | ||||
| 21 | 1 | 100µs | 1 | 262µs | # spent 378µs (116+262) within XML::LibXML::Boolean::BEGIN@21 which was called:
# once (116µs+262µs) by XML::LibXML::NodeList::BEGIN@15 at line 22 # spent 262µs making 1 call to overload::import |
| 22 | 1 | 1.44ms | 1 | 378µs | '<=>' => \&cmp; # spent 378µs making 1 call to XML::LibXML::Boolean::BEGIN@21 |
| 23 | |||||
| 24 | sub new { | ||||
| 25 | my $class = shift; | ||||
| 26 | my ($param) = @_; | ||||
| 27 | my $val = $param ? 1 : 0; | ||||
| 28 | bless \$val, $class; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | sub True { | ||||
| 32 | my $class = shift; | ||||
| 33 | my $val = 1; | ||||
| 34 | bless \$val, $class; | ||||
| 35 | } | ||||
| 36 | |||||
| 37 | sub False { | ||||
| 38 | my $class = shift; | ||||
| 39 | my $val = 0; | ||||
| 40 | bless \$val, $class; | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | sub value { | ||||
| 44 | my $self = shift; | ||||
| 45 | $$self; | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | sub cmp { | ||||
| 49 | my $self = shift; | ||||
| 50 | my ($other, $swap) = @_; | ||||
| 51 | if ($swap) { | ||||
| 52 | return $other <=> $$self; | ||||
| 53 | } | ||||
| 54 | return $$self <=> $other; | ||||
| 55 | } | ||||
| 56 | |||||
| 57 | sub to_number { XML::LibXML::Number->new($_[0]->value); } | ||||
| 58 | sub to_boolean { $_[0]; } | ||||
| 59 | sub to_literal { XML::LibXML::Literal->new($_[0]->value ? "true" : "false"); } | ||||
| 60 | |||||
| 61 | sub string_value { return $_[0]->to_literal->value; } | ||||
| 62 | |||||
| 63 | 1 | 13µs | 1; | ||
| 64 | __END__ |