← Index
NYTProf Performance Profile   « block view • line view • sub view »
For ddd2.pl
  Run on Tue May 25 16:52:24 2010
Reported on Tue May 25 16:56:53 2010

File /project/perl/lib/Class/Date/Const.pm
Statements Executed 49
Statement Execution Time 2.31ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sClass::Date::Const::::BEGINClass::Date::Const::BEGIN
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Class::Date::Const;
23103µs127µsuse strict;
# spent 27µs making 1 call to strict::import
3
4388µs1390µsuse vars qw(@EXPORT @ISA @ERROR_MESSAGES %EXPORT_TAGS);
# spent 390µs making 1 call to vars::import
53411µs1129µsuse Exporter;
# spent 129µs making 1 call to Exporter::import
6
7125µsmy %FIELDS = (
8 # Class::Date fields
9 c_year => 0,
10 c_mon => 1,
11 c_day => 2,
12 c_hour => 3,
13 c_min => 4,
14 c_sec => 5,
15 c_wday => 6,
16 c_yday => 7,
17 c_isdst => 8,
18 c_epoch => 9,
19 c_tz => 10,
20 c_error => 11,
21 c_errmsg => 12,
22 # Class::Date::Rel fields
23 cs_mon => 0,
24 cs_sec => 1,
25 # Class::Date::Invalid fields
26 ci_error => 0,
27 ci_errmsg => 1,
28);
29
302100µseval " sub $_ () { ".$FIELDS{$_}."}" foreach keys %FIELDS;
311974µs@ISA = qw(Exporter);
32
33129µsmy @ERRORS = (
34 E_OK => '',
35 E_INVALID => 'Invalid date or time',
36 E_RANGE => 'Range check on date or time failed',
37 E_UNPARSABLE => 'Unparsable date or time: %s',
38 E_UNDEFINED => 'Undefined date object',
39);
40
4115µsmy @ERR;
42# predeclaring error constants
4315µsmy $c = 0;
44110µswhile (@ERRORS) {
4530480µs my $errorcode = shift @ERRORS;
46 my $errorname = shift @ERRORS;
47 eval "sub $errorcode () { $c }";
48 $ERROR_MESSAGES[$c] = $errorname;
49 push @{$EXPORT_TAGS{errors}}, $errorcode;
50 $c++;
51}
52
53136µs@EXPORT = (keys %FIELDS, qw(@ERROR_MESSAGES), @{$EXPORT_TAGS{errors}});
54
55141µs1;