← Index
NYTProf Performance Profile   « line view »
For Makefile.PL
  Run on Sun Mar 1 16:04:44 2015
Reported on Sun Mar 1 16:09:02 2015

FilenameC:/tmp64ng/perl/lib/ExtUtils/MakeMaker/Locale.pm
StatementsExecuted 50 statements in 15.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11115.6ms31.2msExtUtils::MakeMaker::Locale::::_initExtUtils::MakeMaker::Locale::_init
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@104ExtUtils::MakeMaker::Locale::BEGIN@104
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@105ExtUtils::MakeMaker::Locale::BEGIN@105
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@110ExtUtils::MakeMaker::Locale::BEGIN@110
1110s15.6msExtUtils::MakeMaker::Locale::::BEGIN@13ExtUtils::MakeMaker::Locale::BEGIN@13
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@14ExtUtils::MakeMaker::Locale::BEGIN@14
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@3ExtUtils::MakeMaker::Locale::BEGIN@3
1110s0sExtUtils::MakeMaker::Locale::::BEGIN@6ExtUtils::MakeMaker::Locale::BEGIN@6
1110s0sExtUtils::MakeMaker::Locale::::GetACPExtUtils::MakeMaker::Locale::GetACP (xsub)
3210s0sExtUtils::MakeMaker::Locale::::__ANON__[:107]ExtUtils::MakeMaker::Locale::__ANON__[:107]
0000s0sExtUtils::MakeMaker::Locale::::_flush_aliasesExtUtils::MakeMaker::Locale::_flush_aliases
0000s0sExtUtils::MakeMaker::Locale::::decode_argvExtUtils::MakeMaker::Locale::decode_argv
0000s0sExtUtils::MakeMaker::Locale::::envExtUtils::MakeMaker::Locale::env
0000s0sExtUtils::MakeMaker::Locale::::reinitExtUtils::MakeMaker::Locale::reinit
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package ExtUtils::MakeMaker::Locale;
2
320s20s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@3 which was called: # once (0s+0s) by main::BEGIN@1 at line 3
use strict;
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@3 # spent 0s making 1 call to strict::import
410sour $VERSION = "7.04";
5
620s20s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@6 which was called: # once (0s+0s) by main::BEGIN@1 at line 6
use base 'Exporter';
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@6 # spent 0s making 1 call to base::import
710sour @EXPORT_OK = qw(
8 decode_argv env
9 $ENCODING_LOCALE $ENCODING_LOCALE_FS
10 $ENCODING_CONSOLE_IN $ENCODING_CONSOLE_OUT
11);
12
1320s115.6ms
# spent 15.6ms (0s+15.6) within ExtUtils::MakeMaker::Locale::BEGIN@13 which was called: # once (0s+15.6ms) by main::BEGIN@1 at line 13
use Encode ();
# spent 15.6ms making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@13
1420s10s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@14 which was called: # once (0s+0s) by main::BEGIN@1 at line 14
use Encode::Alias ();
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@14
15
1610sour $ENCODING_LOCALE;
1710sour $ENCODING_LOCALE_FS;
1810sour $ENCODING_CONSOLE_IN;
1910sour $ENCODING_CONSOLE_OUT;
20
21sub DEBUG () { 0 }
22
23
# spent 31.2ms (15.6+15.6) within ExtUtils::MakeMaker::Locale::_init which was called: # once (15.6ms+15.6ms) by main::BEGIN@1 at line 102
sub _init {
2410s if ($^O eq "MSWin32") {
2510s unless ($ENCODING_LOCALE) {
26 # Try to obtain what the Windows ANSI code page is
2710s eval {
2810s unless (defined &GetACP) {
2910s require Win32::API;
3010s10s Win32::API->Import('kernel32', 'int GetACP()');
# spent 0s making 1 call to Win32::API::Import
31 };
3210s if (defined &GetACP) {
3310s10s my $cp = GetACP();
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::GetACP
3410s $ENCODING_LOCALE = "cp$cp" if $cp;
35 }
36 };
37 }
38
3910s unless ($ENCODING_CONSOLE_IN) {
40 # If we have the Win32::Console module installed we can ask
41 # it for the code set to use
4210s eval {
43115.6ms require Win32::Console;
4410s10s my $cp = Win32::Console::InputCP();
# spent 0s making 1 call to Win32::Console::InputCP
4510s $ENCODING_CONSOLE_IN = "cp$cp" if $cp;
4610s10s $cp = Win32::Console::OutputCP();
# spent 0s making 1 call to Win32::Console::OutputCP
4710s $ENCODING_CONSOLE_OUT = "cp$cp" if $cp;
48 };
49 # Invoking the 'chcp' program might also work
5010s if (!$ENCODING_CONSOLE_IN && (qx(chcp) || '') =~ /^Active code page: (\d+)/) {
51 $ENCODING_CONSOLE_IN = "cp$1";
52 }
53 }
54 }
55
5610s unless ($ENCODING_LOCALE) {
57 eval {
58 require I18N::Langinfo;
59 $ENCODING_LOCALE = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
60
61 # Workaround of Encode < v2.25. The "646" encoding alias was
62 # introduced in Encode-2.25, but we don't want to require that version
63 # quite yet. Should avoid the CPAN testers failure reported from
64 # openbsd-4.7/perl-5.10.0 combo.
65 $ENCODING_LOCALE = "ascii" if $ENCODING_LOCALE eq "646";
66
67 # https://rt.cpan.org/Ticket/Display.html?id=66373
68 $ENCODING_LOCALE = "hp-roman8" if $^O eq "hpux" && $ENCODING_LOCALE eq "roman8";
69 };
70 $ENCODING_LOCALE ||= $ENCODING_CONSOLE_IN;
71 }
72
7310s if ($^O eq "darwin") {
74 $ENCODING_LOCALE_FS ||= "UTF-8";
75 }
76
77 # final fallback
7810s $ENCODING_LOCALE ||= $^O eq "MSWin32" ? "cp1252" : "UTF-8";
7910s $ENCODING_LOCALE_FS ||= $ENCODING_LOCALE;
8010s $ENCODING_CONSOLE_IN ||= $ENCODING_LOCALE;
8110s $ENCODING_CONSOLE_OUT ||= $ENCODING_CONSOLE_IN;
82
8310s10s unless (Encode::find_encoding($ENCODING_LOCALE)) {
# spent 0s making 1 call to Encode::find_encoding
84 my $foundit;
85 if (lc($ENCODING_LOCALE) eq "gb18030") {
86 eval {
87 require Encode::HanExtra;
88 };
89 if ($@) {
90 die "Need Encode::HanExtra to be installed to support locale codeset ($ENCODING_LOCALE), stopped";
91 }
92 $foundit++ if Encode::find_encoding($ENCODING_LOCALE);
93 }
94 die "The locale codeset ($ENCODING_LOCALE) isn't one that perl can decode, stopped"
95 unless $foundit;
96
97 }
98
99 # use Data::Dump; ddx $ENCODING_LOCALE, $ENCODING_LOCALE_FS, $ENCODING_CONSOLE_IN, $ENCODING_CONSOLE_OUT;
100}
101
10210s131.2ms_init();
# spent 31.2ms making 1 call to ExtUtils::MakeMaker::Locale::_init
103
# spent 0s within ExtUtils::MakeMaker::Locale::__ANON__[C:/tmp64ng/perl/lib/ExtUtils/MakeMaker/Locale.pm:107] which was called 3 times, avg 0s/call: # 2 times (0s+0s) by Encode::Alias::find_alias at line 38 of Encode/Alias.pm, avg 0s/call # once (0s+0s) by Encode::Alias::define_alias at line 89 of Encode/Alias.pm
Encode::Alias::define_alias(sub {
10420s20s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@104 which was called: # once (0s+0s) by main::BEGIN@1 at line 104
no strict 'refs';
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@104 # spent 0s making 1 call to strict::unimport
10520s20s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@105 which was called: # once (0s+0s) by main::BEGIN@1 at line 105
no warnings 'once';
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@105 # spent 0s making 1 call to warnings::unimport
10630s return ${"ENCODING_" . uc(shift)};
10710s10s}, "locale");
# spent 0s making 1 call to Encode::Alias::define_alias
108
109sub _flush_aliases {
11020s20s
# spent 0s within ExtUtils::MakeMaker::Locale::BEGIN@110 which was called: # once (0s+0s) by main::BEGIN@1 at line 110
no strict 'refs';
# spent 0s making 1 call to ExtUtils::MakeMaker::Locale::BEGIN@110 # spent 0s making 1 call to strict::unimport
111 for my $a (keys %Encode::Alias::Alias) {
112 if (defined ${"ENCODING_" . uc($a)}) {
113 delete $Encode::Alias::Alias{$a};
114 warn "Flushed alias cache for $a" if DEBUG;
115 }
116 }
117}
118
119sub reinit {
120 $ENCODING_LOCALE = shift;
121 $ENCODING_LOCALE_FS = shift;
122 $ENCODING_CONSOLE_IN = $ENCODING_LOCALE;
123 $ENCODING_CONSOLE_OUT = $ENCODING_LOCALE;
124 _init();
125 _flush_aliases();
126}
127
128sub decode_argv {
129 die if defined wantarray;
130 for (@ARGV) {
131 $_ = Encode::decode(locale => $_, @_);
132 }
133}
134
135sub env {
136 my $k = Encode::encode(locale => shift);
137 my $old = $ENV{$k};
138 if (@_) {
139 my $v = shift;
140 if (defined $v) {
141 $ENV{$k} = Encode::encode(locale => $v);
142 }
143 else {
144 delete $ENV{$k};
145 }
146 }
147 return Encode::decode(locale => $old) if defined wantarray;
148}
149
15010s1;
151
152__END__
 
# spent 0s within ExtUtils::MakeMaker::Locale::GetACP which was called: # once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 33
sub ExtUtils::MakeMaker::Locale::GetACP; # xsub