← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:49 2015

Filename/usr/share/perl5/DateTime/Format/Builder/Parser/Strptime.pm
StatementsExecuted 18 statements in 981µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1115.24ms5.51msDateTime::Format::Builder::Parser::Strptime::::BEGIN@10DateTime::Format::Builder::Parser::Strptime::BEGIN@10
11111µs21µsDateTime::Format::Builder::Parser::Strptime::::BEGIN@7DateTime::Format::Builder::Parser::Strptime::BEGIN@7
1117µs34µsDateTime::Format::Builder::Parser::Strptime::::BEGIN@11DateTime::Format::Builder::Parser::Strptime::BEGIN@11
1117µs11µsDateTime::Format::Builder::Parser::Strptime::::BEGIN@8DateTime::Format::Builder::Parser::Strptime::BEGIN@8
1116µs24µsDateTime::Format::Builder::Parser::Strptime::::BEGIN@9DateTime::Format::Builder::Parser::Strptime::BEGIN@9
1114µs4µsDateTime::Format::Builder::Parser::Strptime::::BEGIN@13DateTime::Format::Builder::Parser::Strptime::BEGIN@13
0000s0sDateTime::Format::Builder::Parser::Strptime::::create_parserDateTime::Format::Builder::Parser::Strptime::create_parser
0000s0sDateTime::Format::Builder::Parser::Strptime::::do_matchDateTime::Format::Builder::Parser::Strptime::do_match
0000s0sDateTime::Format::Builder::Parser::Strptime::::post_matchDateTime::Format::Builder::Parser::Strptime::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::Strptime;
2{
32900ns $DateTime::Format::Builder::Parser::Strptime::VERSION = '0.81';
4}
5
6
7221µs231µs
# spent 21µs (11+10) within DateTime::Format::Builder::Parser::Strptime::BEGIN@7 which was called: # once (11µs+10µs) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 7
use strict;
# spent 21µs making 1 call to DateTime::Format::Builder::Parser::Strptime::BEGIN@7 # spent 10µs making 1 call to strict::import
8221µs216µs
# spent 11µs (7+4) within DateTime::Format::Builder::Parser::Strptime::BEGIN@8 which was called: # once (7µs+4µs) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 8
use warnings;
# spent 11µs making 1 call to DateTime::Format::Builder::Parser::Strptime::BEGIN@8 # spent 4µs making 1 call to warnings::import
9224µs241µs
# spent 24µs (6+17) within DateTime::Format::Builder::Parser::Strptime::BEGIN@9 which was called: # once (6µs+17µs) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 9
use vars qw( @ISA );
# spent 24µs making 1 call to DateTime::Format::Builder::Parser::Strptime::BEGIN@9 # spent 17µs making 1 call to vars::import
103706µs35.53ms
# spent 5.51ms (5.24+269µs) within DateTime::Format::Builder::Parser::Strptime::BEGIN@10 which was called: # once (5.24ms+269µs) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 10
use DateTime::Format::Strptime 1.04;
# spent 5.51ms making 1 call to DateTime::Format::Builder::Parser::Strptime::BEGIN@10 # spent 14µs making 1 call to Exporter::import # spent 9µs making 1 call to version::_VERSION
11223µs261µs
# spent 34µs (7+27) within DateTime::Format::Builder::Parser::Strptime::BEGIN@11 which was called: # once (7µs+27µs) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 11
use Params::Validate qw( validate SCALAR HASHREF );
# spent 34µs making 1 call to DateTime::Format::Builder::Parser::Strptime::BEGIN@11 # spent 27µs making 1 call to Exporter::import
12
132172µs14µs
# spent 4µs within DateTime::Format::Builder::Parser::Strptime::BEGIN@13 which was called: # once (4µs+0s) by DateTime::Format::Builder::Parser::BEGIN@1.3 at line 13
use DateTime::Format::Builder::Parser::generic;
1415µs@ISA = qw( DateTime::Format::Builder::Parser::generic );
15
1615µs18µs__PACKAGE__->valid_params(
# spent 8µs making 1 call to DateTime::Format::Builder::Parser::valid_params
17 strptime => {
18 type => SCALAR
19 | HASHREF, # straight pattern or options to DTF::Strptime
20 },
21);
22
23sub create_parser {
24 my ( $self, %args ) = @_;
25
26 # Arguments to DTF::Strptime
27 my $pattern = $args{strptime};
28
29 # Create our strptime parser
30 my $strptime = DateTime::Format::Strptime->new(
31 ( ref $pattern ? %$pattern : ( pattern => $pattern ) ),
32 );
33 unless ( ref $self ) {
34 $self = $self->new(%args);
35 }
36 $self->{strptime} = $strptime;
37
38 # Create our parser
39 return $self->generic_parser(
40 (
41 map { exists $args{$_} ? ( $_ => $args{$_} ) : () }
42 qw(
43 on_match on_fail preprocess postprocess
44 )
45 ),
46 label => $args{label},
47 );
48}
49
50sub do_match {
51 my $self = shift;
52 my $date = shift;
53 local $^W; # bizarre bug
54 # Do the match!
55 my $dt = eval { $self->{strptime}->parse_datetime($date) };
56 return $@ ? undef : $dt;
57}
58
59sub post_match {
60 return $_[2];
61}
62
6313µs1;
64
65# ABSTRACT: strptime based date parsing
66
67__END__