← Index
NYTProf Performance Profile   « block view • line view • sub view »
For xt/tapper-mcp-scheduler-with-db-longrun.t
  Run on Tue May 22 17:18:39 2012
Reported on Tue May 22 17:24:10 2012

Filename/2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/DateTime/Format/Builder/Parser/Quick.pm
StatementsExecuted 15 statements in 262µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11113µs91µsDateTime::Format::Builder::Parser::Quick::::BEGIN@5DateTime::Format::Builder::Parser::Quick::BEGIN@5
11113µs15µsDateTime::Format::Builder::Parser::Quick::::BEGIN@2DateTime::Format::Builder::Parser::Quick::BEGIN@2
1117µs44µsDateTime::Format::Builder::Parser::Quick::::BEGIN@4DateTime::Format::Builder::Parser::Quick::BEGIN@4
1116µs33µsDateTime::Format::Builder::Parser::Quick::::BEGIN@3DateTime::Format::Builder::Parser::Quick::BEGIN@3
0000s0sDateTime::Format::Builder::Parser::Quick::::__ANON__[:68]DateTime::Format::Builder::Parser::Quick::__ANON__[:68]
0000s0sDateTime::Format::Builder::Parser::Quick::::__ANON__[:92]DateTime::Format::Builder::Parser::Quick::__ANON__[:92]
0000s0sDateTime::Format::Builder::Parser::Quick::::create_parserDateTime::Format::Builder::Parser::Quick::create_parser
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::Quick;
2320µs217µs
# spent 15µs (13+2) within DateTime::Format::Builder::Parser::Quick::BEGIN@2 which was called: # once (13µs+2µs) by DateTime::Format::Builder::Parser::BEGIN@1.39 at line 2
use strict;
# spent 15µs making 1 call to DateTime::Format::Builder::Parser::Quick::BEGIN@2 # spent 2µs making 1 call to strict::import
3321µs260µs
# spent 33µs (6+27) within DateTime::Format::Builder::Parser::Quick::BEGIN@3 which was called: # once (6µs+27µs) by DateTime::Format::Builder::Parser::BEGIN@1.39 at line 3
use vars qw( $VERSION %dispatch_data );
# spent 33µs making 1 call to DateTime::Format::Builder::Parser::Quick::BEGIN@3 # spent 27µs making 1 call to vars::import
4319µs280µs
# spent 44µs (7+36) within DateTime::Format::Builder::Parser::Quick::BEGIN@4 which was called: # once (7µs+36µs) by DateTime::Format::Builder::Parser::BEGIN@1.39 at line 4
use Params::Validate qw( SCALAR OBJECT CODEREF validate );
# spent 44µs making 1 call to DateTime::Format::Builder::Parser::Quick::BEGIN@4 # spent 36µs making 1 call to Exporter::import
53189µs2169µs
# spent 91µs (13+78) within DateTime::Format::Builder::Parser::Quick::BEGIN@5 which was called: # once (13µs+78µs) by DateTime::Format::Builder::Parser::BEGIN@1.39 at line 5
use base qw( DateTime::Format::Builder::Parser );
# spent 91µs making 1 call to DateTime::Format::Builder::Parser::Quick::BEGIN@5 # spent 78µs making 1 call to base::import
6
7=head1 NAME
8
9DateTime::Format::Builder::Parser::Quick - Use another formatter, simply
10
11=head1 SYNOPSIS
12
13 use DateTime::Format::Builder (
14 parsers => { parse_datetime => [
15 { Quick => 'DateTime::Format::HTTP' },
16 { Quick => 'DateTime::Format::Mail' },
17 { Quick => 'DateTime::Format::IBeat' },
18 ]});
19
20is the same as:
21
22 use DateTime::Format::HTTP;
23 use DateTime::Format::Mail;
24 use DateTime::Format::IBeat;
25
26 use DateTime::Format::Builder (
27 parsers => { parse_datetime => [
28 sub { eval { DateTime::Format::HTTP->parse_datetime( $_[1] ) } },
29 sub { eval { DateTime::Format::Mail->parse_datetime( $_[1] ) } },
30 sub { eval { DateTime::Format::IBeat->parse_datetime( $_[1] ) } },
31 ]});
32
33(These two pieces of code can both be found in the test
34suite; one as F<quick.t>, the other as F<fall.t>.)
35
36=head1 DESCRIPTION
37
38C<Quick> adds a parser that allows some shortcuts when
39writing fairly standard and mundane calls to other
40formatting modules.
41
42=head1 SPECIFICATION
43
44C<Quick> has two keys, one optional.
45
46The C<Quick> keyword should have an argument of either an
47object or a class name. If it's a class name then the class
48is C<use>d.
49
50The C<method> keyword is optional with a default of
51C<parse_datetime>. It's either name of the method to invoke
52on the object, or a reference to a piece of code.
53
54In any case, the resultant code ends up looking like:
55
56 my $rv = $Quick->$method( $date );
57
58=cut
59
601600ns$VERSION = '0.77';
61
62__PACKAGE__->valid_params(
63 Quick => {
64 type => SCALAR|OBJECT,
65 callbacks => {
66 good_classname => sub {
67 (ref $_[0]) or ( $_[0] =~ /^\w+[:'\w+]*\w+/ )
68 },
69 }
70 },
7118µs113µs method => {
# spent 13µs making 1 call to DateTime::Format::Builder::Parser::valid_params
72 optional => 1,
73 type => SCALAR|CODEREF,
74 },
75);
76
77sub create_parser
78{
79 my ($self, %args) = @_;
80 my $class = $args{Quick};
81 my $method = $args{method};
82 $method = 'parse_datetime' unless defined $method;
83 eval "use $class";
84 die $@ if $@;
85
86 return sub {
87 my ($self, $date) = @_;
88 return unless defined $date;
89 my $rv = eval { $class->$method( $date ) };
90 return $rv if defined $rv;
91 return;
92 };
93}
94
9514µs1;
96
97__END__