Profile of /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/XML/LibXML/Boolean.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 16:57:28 2010
Reported on Tue May 4 16:58:05 2010

File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/XML/LibXML/Boolean.pm
Statements Executed | 17
Statement Execution Time | 17.5ms

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 1.65ms | 3.00ms | XML::LibXML::Boolean::::BEGIN@12XML::LibXML::Boolean::BEGIN@12
1 | 1 | 1 | 21µs | 64µs | XML::LibXML::Boolean::::BEGIN@21XML::LibXML::Boolean::BEGIN@21
1 | 1 | 1 | 12µs | 18µs | XML::LibXML::Boolean::::BEGIN@14XML::LibXML::Boolean::BEGIN@14
1 | 1 | 1 | 11µs | 48µs | XML::LibXML::Boolean::::BEGIN@16XML::LibXML::Boolean::BEGIN@16
1 | 1 | 1 | 10µs | 10µs | XML::LibXML::Boolean::::BEGIN@13XML::LibXML::Boolean::BEGIN@13
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::FalseXML::LibXML::Boolean::False
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::TrueXML::LibXML::Boolean::True
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::cmpXML::LibXML::Boolean::cmp
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::newXML::LibXML::Boolean::new
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::string_valueXML::LibXML::Boolean::string_value
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::to_booleanXML::LibXML::Boolean::to_boolean
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::to_literalXML::LibXML::Boolean::to_literal
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::to_numberXML::LibXML::Boolean::to_number
0 | 0 | 0 | 0s | 0s | XML::LibXML::Boolean::::valueXML::LibXML::Boolean::value

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | # $Id: Boolean.pm 785 2009-07-16 14:17:46Z pajas $
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 | 3 | 217µs | 1 | 3.00ms | # spent 3.00ms (1.65+1.35) within XML::LibXML::Boolean::BEGIN@12 which was called # once (1.65ms+1.35ms) by XML::LibXML::NodeList::BEGIN@12 at line 12 use XML::LibXML::Number; # spent 3.00ms making 1 call to XML::LibXML::Boolean::BEGIN@12
13 | 3 | 39µs | 1 | 10µs | # spent 10µs within XML::LibXML::Boolean::BEGIN@13 which was called # once (10µs+0s) by XML::LibXML::NodeList::BEGIN@12 at line 13 use XML::LibXML::Literal; # spent 10µs making 1 call to XML::LibXML::Boolean::BEGIN@13
14 | 3 | 36µs | 2 | 23µs | # spent 18µs (12+6) within XML::LibXML::Boolean::BEGIN@14 which was called # once (12µs+6µs) by XML::LibXML::NodeList::BEGIN@12 at line 14 use strict; # spent 18µs making 1 call to XML::LibXML::Boolean::BEGIN@14 # spent 6µs making 1 call to strict::import
15 |  |  |  |  |
16 | 3 | 62µs | 2 | 85µs | # spent 48µs (11+37) within XML::LibXML::Boolean::BEGIN@16 which was called # once (11µs+37µs) by XML::LibXML::NodeList::BEGIN@12 at line 16 use vars qw ($VERSION); # spent 48µs making 1 call to XML::LibXML::Boolean::BEGIN@16 # spent 37µs making 1 call to vars::import
17 |  |  |  |  |
18 | 1 | 3µs |  |  | $VERSION = "1.70"; # VERSION TEMPLATE: DO NOT CHANGE
19 |  |  |  |  |
20 |  |  |  |  | use overload
21 |  |  |  |  | # spent 64µs (21+43) within XML::LibXML::Boolean::BEGIN@21 which was called # once (21µs+43µs) by XML::LibXML::NodeList::BEGIN@12 at line 22 '""' => \&value, # spent 42µs making 1 call to overload::import
22 | 3 | 17.2ms | 1 | 64µs | '<=>' => \&cmp; # spent 64µ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 | 9µs |  |  | 1;
64 |  |  |  |  | __END__
65 |  |  |  |  |
66 |  |  |  |  | =head1 NAME
67 |  |  |  |  |
68 |  |  |  |  | XML::LibXML::Boolean - Boolean true/false values
69 |  |  |  |  |
70 |  |  |  |  | =head1 DESCRIPTION
71 |  |  |  |  |
72 |  |  |  |  | XML::LibXML::Boolean objects implement simple boolean true/false objects.
73 |  |  |  |  |
74 |  |  |  |  | =head1 API
75 |  |  |  |  |
76 |  |  |  |  | =head2 XML::LibXML::Boolean->True
77 |  |  |  |  |
78 |  |  |  |  | Creates a new Boolean object with a true value.
79 |  |  |  |  |
80 |  |  |  |  | =head2 XML::LibXML::Boolean->False
81 |  |  |  |  |
82 |  |  |  |  | Creates a new Boolean object with a false value.
83 |  |  |  |  |
84 |  |  |  |  | =head2 value()
85 |  |  |  |  |
86 |  |  |  |  | Returns true or false.
87 |  |  |  |  |
88 |  |  |  |  | =head2 to_literal()
89 |  |  |  |  |
90 |  |  |  |  | Returns the string "true" or "false".
91 |  |  |  |  |
92 |  |  |  |  | =cut