Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/XML/LibXML/Boolean.pm |
Statements | Executed 14 statements in 951µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1000µs | 2.69ms | BEGIN@12 | XML::LibXML::Boolean::
1 | 1 | 1 | 7µs | 23µs | BEGIN@22 | XML::LibXML::Boolean::
1 | 1 | 1 | 6µs | 10µs | BEGIN@15 | XML::LibXML::Boolean::
1 | 1 | 1 | 6µs | 21µs | BEGIN@17 | XML::LibXML::Boolean::
1 | 1 | 1 | 5µs | 15µs | BEGIN@14 | XML::LibXML::Boolean::
1 | 1 | 1 | 4µs | 4µs | BEGIN@13 | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | False | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | True | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | cmp | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | new | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | string_value | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | to_boolean | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | to_literal | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | to_number | XML::LibXML::Boolean::
0 | 0 | 0 | 0s | 0s | value | XML::LibXML::Boolean::
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 | 645µs | 1 | 2.69ms | # spent 2.69ms (1000µs+1.69) within XML::LibXML::Boolean::BEGIN@12 which was called:
# once (1000µs+1.69ms) by XML::LibXML::NodeList::BEGIN@15 at line 12 # spent 2.69ms making 1 call to XML::LibXML::Boolean::BEGIN@12 |
13 | 2 | 18µs | 1 | 4µs | # spent 4µs within XML::LibXML::Boolean::BEGIN@13 which was called:
# once (4µs+0s) by XML::LibXML::NodeList::BEGIN@15 at line 13 # spent 4µs making 1 call to XML::LibXML::Boolean::BEGIN@13 |
14 | 2 | 18µs | 2 | 24µs | # spent 15µs (5+10) within XML::LibXML::Boolean::BEGIN@14 which was called:
# once (5µs+10µs) by XML::LibXML::NodeList::BEGIN@15 at line 14 # spent 15µs making 1 call to XML::LibXML::Boolean::BEGIN@14
# spent 10µs making 1 call to strict::import |
15 | 2 | 20µs | 2 | 13µs | # spent 10µs (6+3) within XML::LibXML::Boolean::BEGIN@15 which was called:
# once (6µs+3µs) by XML::LibXML::NodeList::BEGIN@15 at line 15 # spent 10µs making 1 call to XML::LibXML::Boolean::BEGIN@15
# spent 3µs making 1 call to warnings::import |
16 | |||||
17 | 2 | 37µs | 2 | 37µs | # spent 21µs (6+15) within XML::LibXML::Boolean::BEGIN@17 which was called:
# once (6µs+15µs) by XML::LibXML::NodeList::BEGIN@15 at line 17 # spent 21µs making 1 call to XML::LibXML::Boolean::BEGIN@17
# spent 15µs making 1 call to vars::import |
18 | |||||
19 | 1 | 400ns | $VERSION = "2.0116"; # VERSION TEMPLATE: DO NOT CHANGE | ||
20 | |||||
21 | use overload | ||||
22 | 1 | 5µs | 1 | 16µs | # spent 23µs (7+16) within XML::LibXML::Boolean::BEGIN@22 which was called:
# once (7µs+16µs) by XML::LibXML::NodeList::BEGIN@15 at line 23 # spent 16µs making 1 call to overload::import |
23 | 1 | 206µs | 1 | 23µs | '<=>' => \&cmp; # spent 23µs making 1 call to XML::LibXML::Boolean::BEGIN@22 |
24 | |||||
25 | sub new { | ||||
26 | my $class = shift; | ||||
27 | my ($param) = @_; | ||||
28 | my $val = $param ? 1 : 0; | ||||
29 | bless \$val, $class; | ||||
30 | } | ||||
31 | |||||
32 | sub True { | ||||
33 | my $class = shift; | ||||
34 | my $val = 1; | ||||
35 | bless \$val, $class; | ||||
36 | } | ||||
37 | |||||
38 | sub False { | ||||
39 | my $class = shift; | ||||
40 | my $val = 0; | ||||
41 | bless \$val, $class; | ||||
42 | } | ||||
43 | |||||
44 | sub value { | ||||
45 | my $self = shift; | ||||
46 | $$self; | ||||
47 | } | ||||
48 | |||||
49 | sub cmp { | ||||
50 | my $self = shift; | ||||
51 | my ($other, $swap) = @_; | ||||
52 | if ($swap) { | ||||
53 | return $other <=> $$self; | ||||
54 | } | ||||
55 | return $$self <=> $other; | ||||
56 | } | ||||
57 | |||||
58 | sub to_number { XML::LibXML::Number->new($_[0]->value); } | ||||
59 | sub to_boolean { $_[0]; } | ||||
60 | sub to_literal { XML::LibXML::Literal->new($_[0]->value ? "true" : "false"); } | ||||
61 | |||||
62 | sub string_value { return $_[0]->to_literal->value; } | ||||
63 | |||||
64 | 1 | 2µs | 1; | ||
65 | __END__ |