Profile of DateTime/Locale/Util.pm

← Index
NYTProf Performance Profile «line view»
For -e
Run on Thu Jun 30 16:34:56 2016
Reported on Thu Jun 30 16:35:09 2016

Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/DateTime/Locale/Util.pm
Statements | Executed 9 statements in 298µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 19µs | 22µs | DateTime::Locale::Util::::BEGIN@3DateTime::Locale::Util::BEGIN@3
1 | 1 | 1 | 9µs | 20µs | DateTime::Locale::Util::::BEGIN@6DateTime::Locale::Util::BEGIN@6
1 | 1 | 1 | 7µs | 11µs | DateTime::Locale::Util::::BEGIN@4DateTime::Locale::Util::BEGIN@4
0 | 0 | 0 | 0s | 0s | DateTime::Locale::Util::::_tcDateTime::Locale::Util::_tc
0 | 0 | 0 | 0s | 0s | DateTime::Locale::Util::::parse_locale_codeDateTime::Locale::Util::parse_locale_code

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package DateTime::Locale::Util;
2 |  |  |  |  |
3 | 2 | 23µs | 2 | 24µs | # spent 22µs (19+2) within DateTime::Locale::Util::BEGIN@3 which was called: # once (19µs+2µs) by DateTime::Locale::FromData::BEGIN@6 at line 3 use strict; # spent 22µs making 1 call to DateTime::Locale::Util::BEGIN@3 # spent 2µs making 1 call to strict::import
4 | 2 | 23µs | 2 | 15µs | # spent 11µs (7+4) within DateTime::Locale::Util::BEGIN@4 which was called: # once (7µs+4µs) by DateTime::Locale::FromData::BEGIN@6 at line 4 use warnings; # spent 11µs making 1 call to DateTime::Locale::Util::BEGIN@4 # spent 4µs making 1 call to warnings::import
5 |  |  |  |  |
6 | 2 | 247µs | 2 | 31µs | # spent 20µs (9+11) within DateTime::Locale::Util::BEGIN@6 which was called: # once (9µs+11µs) by DateTime::Locale::FromData::BEGIN@6 at line 6 use Exporter qw( import ); # spent 20µs making 1 call to DateTime::Locale::Util::BEGIN@6 # spent 11µs making 1 call to Exporter::import
7 |  |  |  |  |
8 | 1 | 400ns |  |  | our $VERSION = '1.03';
9 |  |  |  |  |
10 | 1 | 1µs |  |  | our @EXPORT_OK = 'parse_locale_code';
11 |  |  |  |  |
12 |  |  |  |  | sub parse_locale_code {
13 |  |  |  |  | my @pieces = split /-/, $_[0];
14 |  |  |  |  |
15 |  |  |  |  | return unless @pieces;
16 |  |  |  |  |
17 |  |  |  |  | my %codes = ( language => lc shift @pieces );
18 |  |  |  |  | if ( @pieces == 1 ) {
19 |  |  |  |  | if ( length $pieces[0] == 2 || $pieces[0] =~ /^\d\d\d$/ ) {
20 |  |  |  |  | $codes{territory} = uc shift @pieces;
21 |  |  |  |  | }
22 |  |  |  |  | }
23 |  |  |  |  | elsif ( @pieces == 3 ) {
24 |  |  |  |  | $codes{script} = _tc( shift @pieces );
25 |  |  |  |  | $codes{territory} = uc shift @pieces;
26 |  |  |  |  | $codes{variant} = uc shift @pieces;
27 |  |  |  |  | }
28 |  |  |  |  | elsif ( @pieces == 2 ) {
29 |  |  |  |  |
30 |  |  |  |  | # I don't think it's possible to have a script + variant with also
31 |  |  |  |  | # having a territory.
32 |  |  |  |  | if ( length $pieces[1] == 2 || $pieces[1] =~ /^\d\d\d$/ ) {
33 |  |  |  |  | $codes{script} = _tc( shift @pieces );
34 |  |  |  |  | $codes{territory} = uc shift @pieces;
35 |  |  |  |  | }
36 |  |  |  |  | else {
37 |  |  |  |  | $codes{territory} = uc shift @pieces;
38 |  |  |  |  | $codes{variant} = uc shift @pieces;
39 |  |  |  |  | }
40 |  |  |  |  | }
41 |  |  |  |  |
42 |  |  |  |  | return %codes;
43 |  |  |  |  | }
44 |  |  |  |  |
45 |  |  |  |  | sub _tc {
46 |  |  |  |  | return ucfirst lc $_[0];
47 |  |  |  |  | }
48 |  |  |  |  |
49 | 1 | 3µs |  |  | 1;
50 |  |  |  |  |
51 |  |  |  |  | # ABSTRACT: Utility code for DateTime::Locale
52 |  |  |  |  |
53 |  |  |  |  | __END__