Filename | /usr/share/perl5/Modern/Perl.pm |
Statements | Executed 64 statements in 13.0ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 4.74ms | 4.79ms | BEGIN@10 | Modern::Perl::
1 | 1 | 1 | 2.41ms | 2.41ms | BEGIN@13 | Modern::Perl::
1 | 1 | 1 | 2.37ms | 26.4ms | BEGIN@16 | Modern::Perl::
1 | 1 | 1 | 2.21ms | 2.29ms | BEGIN@9 | Modern::Perl::
1 | 1 | 1 | 1.57ms | 1.91ms | BEGIN@12 | Modern::Perl::
4 | 4 | 4 | 102µs | 473µs | import | Modern::Perl::
1 | 1 | 1 | 42µs | 42µs | BEGIN@7 | Modern::Perl::
4 | 1 | 1 | 16µs | 16µs | validate_date | Modern::Perl::
1 | 1 | 1 | 5µs | 5µs | BEGIN@17 | Modern::Perl::
0 | 0 | 0 | 0s | 0s | VERSION | Modern::Perl::
0 | 0 | 0 | 0s | 0s | unimport | Modern::Perl::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Modern::Perl; | ||||
2 | { | ||||
3 | 2 | 1µs | $Modern::Perl::VERSION = '1.20140107'; | ||
4 | } | ||||
5 | # ABSTRACT: enable all of the features of Modern Perl with one import | ||||
6 | |||||
7 | 2 | 99µs | 1 | 42µs | # spent 42µs within Modern::Perl::BEGIN@7 which was called:
# once (42µs+0s) by main::BEGIN@70 at line 7 # spent 42µs making 1 call to Modern::Perl::BEGIN@7 |
8 | |||||
9 | 2 | 2.21ms | 2 | 2.32ms | # spent 2.29ms (2.21+84µs) within Modern::Perl::BEGIN@9 which was called:
# once (2.21ms+84µs) by main::BEGIN@70 at line 9 # spent 2.29ms making 1 call to Modern::Perl::BEGIN@9
# spent 28µs making 1 call to strict::import |
10 | 2 | 4.63ms | 2 | 4.80ms | # spent 4.79ms (4.74+49µs) within Modern::Perl::BEGIN@10 which was called:
# once (4.74ms+49µs) by main::BEGIN@70 at line 10 # spent 4.79ms making 1 call to Modern::Perl::BEGIN@10
# spent 12µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 1.44ms | 1 | 1.91ms | # spent 1.91ms (1.57+334µs) within Modern::Perl::BEGIN@12 which was called:
# once (1.57ms+334µs) by main::BEGIN@70 at line 12 # spent 1.91ms making 1 call to Modern::Perl::BEGIN@12 |
13 | 2 | 2.42ms | 1 | 2.41ms | # spent 2.41ms within Modern::Perl::BEGIN@13 which was called:
# once (2.41ms+0s) by main::BEGIN@70 at line 13 # spent 2.41ms making 1 call to Modern::Perl::BEGIN@13 |
14 | |||||
15 | # enable methods on filehandles; unnecessary when 5.14 autoloads them | ||||
16 | 2 | 1.61ms | 1 | 26.4ms | # spent 26.4ms (2.37+24.0) within Modern::Perl::BEGIN@16 which was called:
# once (2.37ms+24.0ms) by main::BEGIN@70 at line 16 # spent 26.4ms making 1 call to Modern::Perl::BEGIN@16 |
17 | 2 | 386µs | 1 | 5µs | # spent 5µs within Modern::Perl::BEGIN@17 which was called:
# once (5µs+0s) by main::BEGIN@70 at line 17 # spent 5µs making 1 call to Modern::Perl::BEGIN@17 |
18 | |||||
19 | 1 | 100ns | our $VERSION; | ||
20 | |||||
21 | 1 | 200ns | my $wanted_date; | ||
22 | sub VERSION | ||||
23 | { | ||||
24 | my ($self, $version) = @_; | ||||
25 | |||||
26 | return $VERSION unless defined $version; | ||||
27 | return $VERSION if $version < 2009; | ||||
28 | |||||
29 | $wanted_date = $version if (caller(1))[3] =~ /::BEGIN/; | ||||
30 | return 2014; | ||||
31 | } | ||||
32 | |||||
33 | sub import | ||||
34 | # spent 473µs (102+371) within Modern::Perl::import which was called 4 times, avg 118µs/call:
# once (25µs+130µs) by Koha::AuthUtils::BEGIN@20 at line 20 of Koha/AuthUtils.pm
# once (31µs+89µs) by main::BEGIN@70 at line 70 of svc/members/upsert
# once (23µs+79µs) by Koha::Borrower::Debarments::BEGIN@20 at line 20 of Koha/Borrower/Debarments.pm
# once (23µs+73µs) by C4::OAI::Sets::BEGIN@32 at line 32 of C4/OAI/Sets.pm | ||||
35 | 4 | 3µs | my ($class, $date) = @_; | ||
36 | 4 | 2µs | $date = $wanted_date unless defined $date; | ||
37 | |||||
38 | 4 | 8µs | 4 | 16µs | my $feature_tag = validate_date( $date ); # spent 16µs making 4 calls to Modern::Perl::validate_date, avg 4µs/call |
39 | 4 | 2µs | undef $wanted_date; | ||
40 | |||||
41 | 4 | 11µs | 4 | 32µs | warnings->import; # spent 32µs making 4 calls to warnings::import, avg 8µs/call |
42 | 4 | 6µs | 4 | 41µs | strict->import; # spent 41µs making 4 calls to strict::import, avg 10µs/call |
43 | 4 | 14µs | 4 | 211µs | feature->import( $feature_tag ); # spent 211µs making 4 calls to feature::import, avg 53µs/call |
44 | 4 | 99µs | 4 | 71µs | mro::set_mro( scalar caller(), 'c3' ); # spent 71µs making 4 calls to mro::set_mro, avg 18µs/call |
45 | } | ||||
46 | |||||
47 | sub unimport | ||||
48 | { | ||||
49 | warnings->unimport; | ||||
50 | strict->unimport; | ||||
51 | feature->unimport; | ||||
52 | } | ||||
53 | |||||
54 | 1 | 5µs | my %dates = | ||
55 | ( | ||||
56 | 2009 => ':5.10', | ||||
57 | 2010 => ':5.10', | ||||
58 | 2011 => ':5.12', | ||||
59 | 2012 => ':5.14', | ||||
60 | 2013 => ':5.16', | ||||
61 | 2014 => ':5.18', | ||||
62 | ); | ||||
63 | |||||
64 | sub validate_date | ||||
65 | # spent 16µs within Modern::Perl::validate_date which was called 4 times, avg 4µs/call:
# 4 times (16µs+0s) by Modern::Perl::import at line 38, avg 4µs/call | ||||
66 | 4 | 2µs | my $date = shift; | ||
67 | |||||
68 | # always enable unicode_strings when available | ||||
69 | 4 | 2µs | unless ($date) | ||
70 | { | ||||
71 | 4 | 32µs | return ':5.12' if $] > 5.011003; | ||
72 | return ':5.10'; | ||||
73 | } | ||||
74 | |||||
75 | my $year = substr $date, 0, 4; | ||||
76 | return $dates{$year} if exists $dates{$year}; | ||||
77 | |||||
78 | die "Unknown date '$date' requested\n"; | ||||
79 | } | ||||
80 | |||||
81 | |||||
82 | 1 | 5µs | 1; | ||
83 | |||||
84 | __END__ |