| Filename | /usr/share/perl5/DateTime/Format/Builder/Parser/Dispatch.pm |
| Statements | Executed 21 statements in 413µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 22µs | 26µs | DateTime::Format::Builder::Parser::Dispatch::BEGIN@2 |
| 1 | 1 | 1 | 20µs | 24µs | DateTime::Format::Builder::Parser::Dispatch::BEGIN@5 |
| 1 | 1 | 1 | 16µs | 62µs | DateTime::Format::Builder::Parser::Dispatch::BEGIN@4 |
| 1 | 1 | 1 | 12µs | 53µs | DateTime::Format::Builder::Parser::Dispatch::BEGIN@3 |
| 1 | 1 | 1 | 10µs | 23µs | DateTime::Format::Builder::Parser::Dispatch::BEGIN@78 |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::Builder::Parser::Dispatch::__ANON__[:111] |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::Builder::Parser::Dispatch::create_parser |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package DateTime::Format::Builder::Parser::Dispatch; | ||||
| 2 | 3 | 36µs | 2 | 31µs | # spent 26µs (22+4) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@2 which was called:
# once (22µs+4µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 2 # spent 26µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@2
# spent 4µs making 1 call to strict::import |
| 3 | 3 | 36µs | 2 | 95µs | # spent 53µs (12+41) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@3 which was called:
# once (12µs+41µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 3 # spent 53µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@3
# spent 41µs making 1 call to vars::import |
| 4 | 3 | 37µs | 2 | 108µs | # spent 62µs (16+46) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@4 which was called:
# once (16µs+46µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 4 # spent 62µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@4
# spent 46µs making 1 call to Exporter::import |
| 5 | 3 | 68µs | 2 | 27µs | # spent 24µs (20+3) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@5 which was called:
# once (20µs+3µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 5 # spent 24µs making 1 call to DateTime::Format::Builder::Parser::Dispatch::BEGIN@5
# spent 3µs making 1 call to UNIVERSAL::import |
| 6 | |||||
| 7 | =head1 NAME | ||||
| 8 | |||||
| - - | |||||
| 75 | 1 | 2µs | $VERSION = '0.78'; | ||
| 76 | |||||
| 77 | { | ||||
| 78 | 4 | 216µs | 2 | 37µs | # spent 23µs (10+14) within DateTime::Format::Builder::Parser::Dispatch::BEGIN@78 which was called:
# once (10µs+14µs) by DateTime::Format::Builder::Parser::BEGIN@1 at line 78 # spent 23µ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 | 79µs | Dispatch => { # spent 79µ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 | 6µs | 1; | ||
| 115 | |||||
| 116 | __END__ |