← 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 11:58:52 2013
Reported on Tue Oct 15 12:01:06 2013

Filename/usr/share/perl5/DateTime/Format/Builder/Parser/Regex.pm
StatementsExecuted 76 statements in 935µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111659µs899µsDateTime::Format::Builder::Parser::Regex::::BEGIN@73DateTime::Format::Builder::Parser::Regex::BEGIN@73
1011165µs966µsDateTime::Format::Builder::Parser::Regex::::create_parserDateTime::Format::Builder::Parser::Regex::create_parser
202162µs62µsDateTime::Format::Builder::Parser::Regex::::__ANON__[:84]DateTime::Format::Builder::Parser::Regex::__ANON__[:84]
11131µs38µsDateTime::Format::Builder::Parser::Regex::::BEGIN@68DateTime::Format::Builder::Parser::Regex::BEGIN@68
11118µs95µsDateTime::Format::Builder::Parser::Regex::::BEGIN@69DateTime::Format::Builder::Parser::Regex::BEGIN@69
11114µs77µsDateTime::Format::Builder::Parser::Regex::::BEGIN@70DateTime::Format::Builder::Parser::Regex::BEGIN@70
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
- -
68360µs244µs
# spent 38µs (31+7) within DateTime::Format::Builder::Parser::Regex::BEGIN@68 which was called: # once (31µs+7µs) by DateTime::Format::Builder::Parser::BEGIN@1.4 at line 68
use strict;
# spent 38µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@68 # spent 7µs making 1 call to strict::import
69358µs2172µs
# spent 95µs (18+77) within DateTime::Format::Builder::Parser::Regex::BEGIN@69 which was called: # once (18µs+77µs) by DateTime::Format::Builder::Parser::BEGIN@1.4 at line 69
use vars qw( $VERSION @ISA );
# spent 95µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@69 # spent 77µs making 1 call to vars::import
70341µs2140µs
# spent 77µs (14+63) within DateTime::Format::Builder::Parser::Regex::BEGIN@70 which was called: # once (14µs+63µs) by DateTime::Format::Builder::Parser::BEGIN@1.4 at line 70
use Params::Validate qw( validate ARRAYREF SCALARREF HASHREF CODEREF );
# spent 77µs making 1 call to DateTime::Format::Builder::Parser::Regex::BEGIN@70 # spent 64µs making 1 call to Exporter::import
71
721800ns$VERSION = '0.77';
733508µs1899µs
# spent 899µs (659+239) within DateTime::Format::Builder::Parser::Regex::BEGIN@73 which was called: # once (659µs+239µs) by DateTime::Format::Builder::Parser::BEGIN@1.4 at line 73
use DateTime::Format::Builder::Parser::generic;
74111µ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 => {
842092µs
# spent 62µ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 (32µs+0s) by Params::Validate::_validate at line 333 of DateTime/Format/Builder/Parser.pm, avg 3µs/call # 10 times (31µs+0s) by Params::Validate::_validate at line 311 of DateTime/Format/Builder/Parser.pm, avg 3µ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 },
101116µs122µ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 966µs (165+800) within DateTime::Format::Builder::Parser::Regex::create_parser which was called 10 times, avg 97µs/call: # 10 times (165µs+800µs) by DateTime::Format::Builder::Parser::create_single_parser at line 334 of DateTime/Format/Builder/Parser.pm, avg 97µs/call
{
14140141µs my ($self, %args) = @_;
142 $args{extra} ||= {};
1431056µs unless (ref $self)
# spent 56µs making 10 calls to DateTime::Format::Builder::Parser::generic::new, avg 6µs/call
144 {
145 $self = $self->new( %args );
146 }
147
148 # Create our parser
149 return $self->generic_parser(
15010744µs ( map { exists $args{$_} ? ( $_ => $args{$_} ) : () } qw(
# spent 744µs making 10 calls to DateTime::Format::Builder::Parser::generic::generic_parser, avg 74µs/call
151 on_match on_fail preprocess postprocess
152 ) ),
153 label => $args{label},
154 );
155}
156
157
15818µs1;
159
160__END__