← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:12:39 2013

Filename/usr/share/perl5/DateTime/Format/Builder/Parser/Regex.pm
StatementsExecuted 76 statements in 989µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111740µs1.08msDateTime::Format::Builder::Parser::Regex::::BEGIN@73DateTime::Format::Builder::Parser::Regex::BEGIN@73
1011152µs876µsDateTime::Format::Builder::Parser::Regex::::create_parserDateTime::Format::Builder::Parser::Regex::create_parser
202154µs54µsDateTime::Format::Builder::Parser::Regex::::__ANON__[:84]DateTime::Format::Builder::Parser::Regex::__ANON__[:84]
11133µs40µsDateTime::Format::Builder::Parser::Regex::::BEGIN@68DateTime::Format::Builder::Parser::Regex::BEGIN@68
11117µs117µsDateTime::Format::Builder::Parser::Regex::::BEGIN@70DateTime::Format::Builder::Parser::Regex::BEGIN@70
11112µs57µsDateTime::Format::Builder::Parser::Regex::::BEGIN@69DateTime::Format::Builder::Parser::Regex::BEGIN@69
0000s0sDateTime::Format::Builder::Parser::Regex::::__ANON__[:98]DateTime::Format::Builder::Parser::Regex::__ANON__[:98]
0000s0sDateTime::Format::Builder::Parser::Regex::::do_matchDateTime::Format::Builder::Parser::Regex::do_match
0000s0sDateTime::Format::Builder::Parser::Regex::::makeDateTime::Format::Builder::Parser::Regex::make
0000s0sDateTime::Format::Builder::Parser::Regex::::post_matchDateTime::Format::Builder::Parser::Regex::post_match
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DateTime::Format::Builder::Parser::Regex;
2
3=head1 NAME
4
- -
68354µs246µs
# spent 40µs (33+6) within DateTime::Format::Builder::Parser::Regex::BEGIN@68 which was called: # once (33µs+6µs) by DateTime::Format::Builder::Parser::BEGIN@1.6 at line 68
use strict;
# spent 40µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@68 # spent 6µs making 1 call to strict::import
69373µs2103µs
# spent 57µs (12+45) within DateTime::Format::Builder::Parser::Regex::BEGIN@69 which was called: # once (12µs+45µs) by DateTime::Format::Builder::Parser::BEGIN@1.6 at line 69
use vars qw( $VERSION @ISA );
# spent 57µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@69 # spent 45µs making 1 call to vars::import
70345µs2217µs
# spent 117µs (17+100) within DateTime::Format::Builder::Parser::Regex::BEGIN@70 which was called: # once (17µs+100µs) by DateTime::Format::Builder::Parser::BEGIN@1.6 at line 70
use Params::Validate qw( validate ARRAYREF SCALARREF HASHREF CODEREF );
# spent 117µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@70 # spent 100µs making 1 call to Exporter::import
71
721800ns$VERSION = '0.77';
733551µs21.09ms
# spent 1.08ms (740µs+345µs) within DateTime::Format::Builder::Parser::Regex::BEGIN@73 which was called: # once (740µs+345µs) by DateTime::Format::Builder::Parser::BEGIN@1.6 at line 73
use DateTime::Format::Builder::Parser::generic;
# spent 1.08ms making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@73 # spent 4µs making 1 call to UNIVERSAL::import
74126µs@ISA = qw( DateTime::Format::Builder::Parser::generic );
75
76__PACKAGE__->valid_params(
77# How to match
78 params => {
79 type => ARRAYREF, # mapping $1,$2,... to new() args
80 },
81 regex => {
82 type => SCALARREF,
83 callbacks => {
842084µs
# spent 54µs within DateTime::Format::Builder::Parser::Regex::__ANON__[/usr/share/perl5/DateTime/Format/Builder/Parser/Regex.pm:84] which was called 20 times, avg 3µs/call: # 10 times (30µs+0s) by Params::Validate::_validate at line 311 of DateTime/Format/Builder/Parser.pm, avg 3µs/call # 10 times (25µs+0s) by Params::Validate::_validate at line 333 of DateTime/Format/Builder/Parser.pm, avg 2µs/call
'is a regex' => sub { ref(shift) eq 'Regexp' }
85 }
86 },
87# How to create
88 extra => {
89 type => HASHREF,
90 optional => 1,
91 },
92 constructor => {
93 type => CODEREF|ARRAYREF,
94 optional => 1,
95 callbacks => {
96 'array has 2 elements' => sub {
97 ref($_[0]) eq 'ARRAY' ? (@{$_[0]} == 2) : 1
98 }
99 }
100 },
101118µs120µs);
102
103sub do_match
104{
105 my $self = shift;
106 my $date = shift;
107 my @matches = $date =~ $self->{regex};
108 return @matches ? \@matches : undef;
109}
110
111sub post_match
112{
113 my $self = shift;
114 my ( $date, $matches, $p ) = @_;
115 # Fill %p from match
116 @{$p}{ @{ $self->{params} } } = @$matches;
117 return;
118}
119
120sub make {
121 my $self = shift;
122 my ( $date, $dt, $p ) = @_;
123 my @args = ( %$p, %{ $self->{extra} } );
124 if (my $cons = $self->{constructor})
125 {
126 if (ref $cons eq 'ARRAY') {
127 my ($class, $method) = @$cons;
128 return $class->$method(@args);
129 } elsif (ref $cons eq 'CODE') {
130 return $self->$cons( @args );
131 }
132 }
133 else
134 {
135 return DateTime->new(@args);
136 }
137}
138
139sub create_parser
140
# spent 876µs (152+724) within DateTime::Format::Builder::Parser::Regex::create_parser which was called 10 times, avg 88µs/call: # 10 times (152µs+724µs) by DateTime::Format::Builder::Parser::create_single_parser at line 334 of DateTime/Format/Builder/Parser.pm, avg 88µs/call
{
1411017µs my ($self, %args) = @_;
142106µs $args{extra} ||= {};
1431033µs1054µs unless (ref $self)
# spent 54µs making 10 calls to DateTime::Format::Builder::Parser::generic::new, avg 5µs/call
144 {
145 $self = $self->new( %args );
146 }
147
148 # Create our parser
149 return $self->generic_parser(
1501073µs10670µs ( map { exists $args{$_} ? ( $_ => $args{$_} ) : () } qw(
# spent 670µs making 10 calls to DateTime::Format::Builder::Parser::generic::generic_parser, avg 67µs/call
151 on_match on_fail preprocess postprocess
152 ) ),
153 label => $args{label},
154 );
155}
156
157
15818µs1;
159
160__END__