| Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/Modern/Perl.pm |
| Statements | Executed 31 statements in 3.65ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.10ms | 2.12ms | Modern::Perl::BEGIN@10 |
| 1 | 1 | 1 | 761µs | 761µs | Modern::Perl::BEGIN@13 |
| 1 | 1 | 1 | 653µs | 8.99ms | Modern::Perl::BEGIN@16 |
| 1 | 1 | 1 | 325µs | 360µs | Modern::Perl::BEGIN@9 |
| 1 | 1 | 1 | 228µs | 419µs | Modern::Perl::BEGIN@12 |
| 1 | 1 | 1 | 23µs | 98µs | Modern::Perl::import |
| 1 | 1 | 1 | 20µs | 20µs | Modern::Perl::BEGIN@7 |
| 1 | 1 | 1 | 5µs | 5µs | Modern::Perl::validate_date |
| 1 | 1 | 1 | 3µs | 3µs | Modern::Perl::BEGIN@17 |
| 0 | 0 | 0 | 0s | 0s | Modern::Perl::VERSION |
| 0 | 0 | 0 | 0s | 0s | Modern::Perl::unimport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Modern::Perl; | ||||
| 2 | { | ||||
| 3 | 2 | 800ns | $Modern::Perl::VERSION = '1.20121103'; | ||
| 4 | } | ||||
| 5 | # ABSTRACT: enable all of the features of Modern Perl with one import | ||||
| 6 | |||||
| 7 | 2 | 56µs | 1 | 20µs | # spent 20µs within Modern::Perl::BEGIN@7 which was called:
# once (20µs+0s) by main::BEGIN@1 at line 7 # spent 20µs making 1 call to Modern::Perl::BEGIN@7 |
| 8 | |||||
| 9 | 2 | 315µs | 2 | 377µs | # spent 360µs (325+35) within Modern::Perl::BEGIN@9 which was called:
# once (325µs+35µs) by main::BEGIN@1 at line 9 # spent 360µs making 1 call to Modern::Perl::BEGIN@9
# spent 17µs making 1 call to strict::import |
| 10 | 2 | 2.00ms | 2 | 2.13ms | # spent 2.12ms (2.10+24µs) within Modern::Perl::BEGIN@10 which was called:
# once (2.10ms+24µs) by main::BEGIN@1 at line 10 # spent 2.12ms making 1 call to Modern::Perl::BEGIN@10
# spent 10µs making 1 call to warnings::import |
| 11 | |||||
| 12 | 2 | 81µs | 1 | 419µs | # spent 419µs (228+192) within Modern::Perl::BEGIN@12 which was called:
# once (228µs+192µs) by main::BEGIN@1 at line 12 # spent 419µs making 1 call to Modern::Perl::BEGIN@12 |
| 13 | 2 | 756µs | 1 | 761µs | # spent 761µs within Modern::Perl::BEGIN@13 which was called:
# once (761µs+0s) by main::BEGIN@1 at line 13 # spent 761µs making 1 call to Modern::Perl::BEGIN@13 |
| 14 | |||||
| 15 | # enable methods on filehandles; unnecessary when 5.14 autoloads them | ||||
| 16 | 2 | 139µs | 1 | 8.99ms | # spent 8.99ms (653µs+8.33) within Modern::Perl::BEGIN@16 which was called:
# once (653µs+8.33ms) by main::BEGIN@1 at line 16 # spent 8.99ms making 1 call to Modern::Perl::BEGIN@16 |
| 17 | 2 | 265µs | 1 | 3µs | # spent 3µs within Modern::Perl::BEGIN@17 which was called:
# once (3µs+0s) by main::BEGIN@1 at line 17 # spent 3µs making 1 call to Modern::Perl::BEGIN@17 |
| 18 | |||||
| 19 | 1 | 0s | our $VERSION; | ||
| 20 | |||||
| 21 | 1 | 100ns | 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 2012; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | sub import | ||||
| 34 | # spent 98µs (23+75) within Modern::Perl::import which was called:
# once (23µs+75µs) by main::BEGIN@1 at line 1 of examples/Atom-timer.pl | ||||
| 35 | 1 | 500ns | my ($class, $date) = @_; | ||
| 36 | 1 | 200ns | $date = $wanted_date unless defined $date; | ||
| 37 | |||||
| 38 | 1 | 1µs | 1 | 5µs | my $feature_tag = validate_date( $date ); # spent 5µs making 1 call to Modern::Perl::validate_date |
| 39 | 1 | 200ns | undef $wanted_date; | ||
| 40 | |||||
| 41 | 1 | 1µs | 1 | 4µs | warnings->import(); # spent 4µs making 1 call to warnings::import |
| 42 | 1 | 1µs | 1 | 10µs | strict->import(); # spent 10µs making 1 call to strict::import |
| 43 | 1 | 2µs | 1 | 50µs | feature->import( $feature_tag ); # spent 50µs making 1 call to feature::import |
| 44 | 1 | 13µs | 1 | 6µs | mro::set_mro( scalar caller(), 'c3' ); # spent 6µs making 1 call to mro::set_mro |
| 45 | } | ||||
| 46 | |||||
| 47 | sub unimport | ||||
| 48 | { | ||||
| 49 | warnings->unimport; | ||||
| 50 | strict->unimport; | ||||
| 51 | feature->unimport; | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | 1 | 3µ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 | ); | ||||
| 62 | |||||
| 63 | sub validate_date | ||||
| 64 | # spent 5µs within Modern::Perl::validate_date which was called:
# once (5µs+0s) by Modern::Perl::import at line 38 | ||||
| 65 | 1 | 200ns | my $date = shift; | ||
| 66 | |||||
| 67 | # always enable unicode_strings when available | ||||
| 68 | 1 | 100ns | unless ($date) | ||
| 69 | { | ||||
| 70 | 1 | 10µs | return ':5.12' if $] > 5.011003; | ||
| 71 | return ':5.10'; | ||||
| 72 | } | ||||
| 73 | |||||
| 74 | my $year = substr $date, 0, 4; | ||||
| 75 | return $dates{$year} if exists $dates{$year}; | ||||
| 76 | |||||
| 77 | die "Unknown date '$date' requested\n"; | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | |||||
| 81 | 1 | 5µs | 1; | ||
| 82 | |||||
| 83 | __END__ |