Filename | /usr/share/perl5/DateTime/Format/Builder/Parser/Dispatch.pm |
Statements | Executed 21 statements in 439µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 24µs | 29µs | BEGIN@2 | DateTime::Format::Builder::Parser::Dispatch::
1 | 1 | 1 | 17µs | 83µs | BEGIN@4 | DateTime::Format::Builder::Parser::Dispatch::
1 | 1 | 1 | 13µs | 13µs | BEGIN@5 | DateTime::Format::Builder::Parser::Dispatch::
1 | 1 | 1 | 12µs | 52µs | BEGIN@3 | DateTime::Format::Builder::Parser::Dispatch::
1 | 1 | 1 | 9µs | 22µs | BEGIN@78 | DateTime::Format::Builder::Parser::Dispatch::
0 | 0 | 0 | 0s | 0s | __ANON__[:111] | DateTime::Format::Builder::Parser::Dispatch::
0 | 0 | 0 | 0s | 0s | create_parser | DateTime::Format::Builder::Parser::Dispatch::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::Format::Builder::Parser::Dispatch; | ||||
2 | 3 | 44µs | 2 | 33µs | # spent 29µs (24+4) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@2 which was called:
# once (24µs+4µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 2 # spent 29µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@2
# spent 4µs making 1 call to strict::import |
3 | 3 | 42µs | 2 | 93µs | # spent 52µs (12+40) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@3 which was called:
# once (12µs+40µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 3 # spent 52µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@3
# spent 40µs making 1 call to vars::import |
4 | 3 | 47µs | 2 | 149µs | # spent 83µs (17+66) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@4 which was called:
# once (17µs+66µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 4 # spent 83µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@4
# spent 66µs making 1 call to Exporter::import |
5 | 3 | 57µs | 1 | 13µs | # spent 13µs within DateTime::Format::Builder::Parser::Dispatch::BEGIN@5 which was called:
# once (13µs+0s) by DateTime::Format::Builder::Parser::BEGIN@1 at line 5 # spent 13µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@5 |
6 | |||||
7 | =head1 NAME | ||||
8 | |||||
- - | |||||
75 | 1 | 2µs | $VERSION = '0.78'; | ||
76 | |||||
77 | { | ||||
78 | 4 | 228µs | 2 | 36µs | # spent 22µs (9+14) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@78 which was called:
# once (9µs+14µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 78 # spent 22µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@78
# spent 14µs making 1 call to strict::unimport |
79 | 1 | 3µs | *dispatch_data = *DateTime::Format::Builder::dispatch_data; | ||
80 | 1 | 2µs | *params = *DateTime::Format::Builder::Parser::params; | ||
81 | } | ||||
82 | |||||
83 | DateTime::Format::Builder::Parser->valid_params( | ||||
84 | 1 | 8µs | 1 | 20µs | Dispatch => { # spent 20µs making 1 call to DateTime::Format::Builder::Parser::valid_params |
85 | type => CODEREF, | ||||
86 | } | ||||
87 | ); | ||||
88 | |||||
89 | sub create_parser | ||||
90 | { | ||||
91 | my ($self, %args) = @_; | ||||
92 | my $coderef = $args{Dispatch}; | ||||
93 | |||||
94 | return sub { | ||||
95 | my ($self, $date, $p, @args) = @_; | ||||
96 | return unless defined $date; | ||||
97 | my $class = ref($self)||$self; | ||||
98 | |||||
99 | my @results = $coderef->( $date ); | ||||
100 | return unless @results; | ||||
101 | return unless defined $results[0]; | ||||
102 | |||||
103 | for my $group (@results) | ||||
104 | { | ||||
105 | my $parser = $dispatch_data{$class}{$group}; | ||||
106 | die "Unknown parsing group: $class\n" unless defined $parser; | ||||
107 | my $rv = eval { $parser->parse( $self, $date, $p, @args ) }; | ||||
108 | return $rv unless $@ or not defined $rv; | ||||
109 | } | ||||
110 | return; | ||||
111 | }; | ||||
112 | } | ||||
113 | |||||
114 | 1 | 8µs | 1; | ||
115 | |||||
116 | __END__ |