Filename | /usr/share/perl5/Text/CSV.pm |
Statements | Executed 86 statements in 1.62ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 120µs | 120µs | _set_methods | Text::CSV::
1 | 1 | 1 | 83µs | 3.91ms | _load_xs | Text::CSV::
1 | 1 | 1 | 40µs | 47µs | BEGIN@4 | Text::CSV::
1 | 1 | 1 | 25µs | 98µs | BEGIN@6 | Text::CSV::
1 | 1 | 1 | 12µs | 34µs | BEGIN@136 | Text::CSV::
1 | 1 | 1 | 11µs | 24µs | BEGIN@196 | Text::CSV::
1 | 1 | 1 | 10µs | 10µs | BEGIN@5 | Text::CSV::
1 | 1 | 1 | 7µs | 7µs | BEGIN@8 | Text::CSV::
1 | 1 | 1 | 3µs | 3µs | import | Text::CSV::
0 | 0 | 0 | 0s | 0s | AUTOLOAD | Text::CSV::
0 | 0 | 0 | 0s | 0s | _load_pp | Text::CSV::
0 | 0 | 0 | 0s | 0s | is_dynamic | Text::CSV::
0 | 0 | 0 | 0s | 0s | is_pp | Text::CSV::
0 | 0 | 0 | 0s | 0s | is_xs | Text::CSV::
0 | 0 | 0 | 0s | 0s | module | Text::CSV::
0 | 0 | 0 | 0s | 0s | new | Text::CSV::
0 | 0 | 0 | 0s | 0s | require_xs_version | Text::CSV::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Text::CSV; | ||||
2 | |||||
3 | |||||
4 | 3 | 54µs | 2 | 54µs | # spent 47µs (40+7) within Text::CSV::BEGIN@4 which was called:
# once (40µs+7µs) by C4::Members::Attributes::BEGIN@23 at line 4 # spent 47µs making 1 call to Text::CSV::BEGIN@4
# spent 7µs making 1 call to strict::import |
5 | 3 | 58µs | 1 | 10µs | # spent 10µs within Text::CSV::BEGIN@5 which was called:
# once (10µs+0s) by C4::Members::Attributes::BEGIN@23 at line 5 # spent 10µs making 1 call to Text::CSV::BEGIN@5 |
6 | 3 | 73µs | 2 | 171µs | # spent 98µs (25+73) within Text::CSV::BEGIN@6 which was called:
# once (25µs+73µs) by C4::Members::Attributes::BEGIN@23 at line 6 # spent 98µs making 1 call to Text::CSV::BEGIN@6
# spent 73µs making 1 call to vars::import |
7 | |||||
8 | # spent 7µs within Text::CSV::BEGIN@8 which was called:
# once (7µs+0s) by C4::Members::Attributes::BEGIN@23 at line 11 | ||||
9 | 2 | 6µs | $VERSION = '1.18'; | ||
10 | $DEBUG = 0; | ||||
11 | 1 | 701µs | 1 | 7µs | } # spent 7µs making 1 call to Text::CSV::BEGIN@8 |
12 | |||||
13 | # if use CSV_XS, requires version | ||||
14 | 1 | 1µs | my $Module_XS = 'Text::CSV_XS'; | ||
15 | 1 | 300ns | my $Module_PP = 'Text::CSV_PP'; | ||
16 | 1 | 200ns | my $XS_Version = '0.72'; | ||
17 | |||||
18 | 1 | 200ns | my $Is_Dynamic = 0; | ||
19 | |||||
20 | # used in _load_xs and _load_pp | ||||
21 | 1 | 200ns | my $Install_Dont_Die = 1; # When _load_xs fails to load XS, don't die. | ||
22 | 1 | 200ns | my $Install_Only = 2; # Don't call _set_methods() | ||
23 | |||||
24 | |||||
25 | 1 | 11µs | my @PublicMethods = qw/ | ||
26 | version types quote_char escape_char sep_char eol always_quote binary allow_whitespace | ||||
27 | keep_meta_info allow_loose_quotes allow_loose_escapes verbatim meta_info is_quoted is_binary eof | ||||
28 | getline print parse combine fields string error_diag error_input status blank_is_undef empty_is_undef | ||||
29 | getline_hr column_names bind_columns auto_diag quote_space quote_null | ||||
30 | PV IV NV | ||||
31 | /; | ||||
32 | # | ||||
33 | 1 | 1µs | my @UndocumentedXSMethods = qw/Combine Parse SetDiag/; | ||
34 | |||||
35 | 1 | 300ns | my @UndocumentedPPMethods = qw//; # Currently empty | ||
36 | |||||
37 | |||||
38 | # Check the environment variable to decide worker module. | ||||
39 | |||||
40 | 3 | 4µs | unless ($Text::CSV::Worker) { | ||
41 | $Text::CSV::DEBUG and Carp::carp("Check used worker module..."); | ||||
42 | |||||
43 | 1 | 3µs | if ( exists $ENV{PERL_TEXT_CSV} ) { | ||
44 | if ($ENV{PERL_TEXT_CSV} eq '0' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_PP') { | ||||
45 | _load_pp(); | ||||
46 | } | ||||
47 | elsif ($ENV{PERL_TEXT_CSV} eq '1' or $ENV{PERL_TEXT_CSV} =~ /Text::CSV_XS\s*,\s*Text::CSV_PP/) { | ||||
48 | _load_xs($Install_Dont_Die) or _load_pp(); | ||||
49 | } | ||||
50 | elsif ($ENV{PERL_TEXT_CSV} eq '2' or $ENV{PERL_TEXT_CSV} eq 'Text::CSV_XS') { | ||||
51 | _load_xs(); | ||||
52 | } | ||||
53 | else { | ||||
54 | Carp::croak "The value of environmental variable 'PERL_TEXT_CSV' is invalid."; | ||||
55 | } | ||||
56 | } | ||||
57 | else { | ||||
58 | 1 | 3.91ms | _load_xs($Install_Dont_Die) or _load_pp(); # spent 3.91ms making 1 call to Text::CSV::_load_xs | ||
59 | } | ||||
60 | |||||
61 | } | ||||
62 | |||||
- - | |||||
65 | # spent 3µs within Text::CSV::import which was called:
# once (3µs+0s) by C4::Members::Attributes::BEGIN@23 at line 23 of /usr/share/koha/lib/C4/Members/Attributes.pm | ||||
66 | 1 | 5µs | my ($class, $option) = @_; | ||
67 | } | ||||
68 | |||||
- - | |||||
71 | sub new { # normal mode | ||||
72 | my $proto = shift; | ||||
73 | my $class = ref($proto) || $proto; | ||||
74 | |||||
75 | unless ( $proto ) { # for Text::CSV_XS/PP::new(0); | ||||
76 | return eval qq| $Text::CSV::Worker\::new( \$proto ) |; | ||||
77 | } | ||||
78 | |||||
79 | #if (ref $_[0] and $_[0]->{module}) { | ||||
80 | # Carp::croak("Can't set 'module' in non dynamic mode."); | ||||
81 | #} | ||||
82 | |||||
83 | if ( my $obj = $Text::CSV::Worker->new(@_) ) { | ||||
84 | $obj->{_MODULE} = $Text::CSV::Worker; | ||||
85 | bless $obj, $class; | ||||
86 | return $obj; | ||||
87 | } | ||||
88 | else { | ||||
89 | return; | ||||
90 | } | ||||
91 | |||||
92 | |||||
93 | } | ||||
94 | |||||
95 | |||||
96 | sub require_xs_version { $XS_Version; } | ||||
97 | |||||
98 | |||||
99 | sub module { | ||||
100 | my $proto = shift; | ||||
101 | return !ref($proto) ? $Text::CSV::Worker | ||||
102 | : ref($proto->{_MODULE}) ? ref($proto->{_MODULE}) : $proto->{_MODULE}; | ||||
103 | } | ||||
104 | |||||
105 | 1 | 2µs | *backend = *module; | ||
106 | |||||
107 | |||||
108 | sub is_xs { | ||||
109 | return $_[0]->module eq $Module_XS; | ||||
110 | } | ||||
111 | |||||
112 | |||||
113 | sub is_pp { | ||||
114 | return $_[0]->module eq $Module_PP; | ||||
115 | } | ||||
116 | |||||
117 | |||||
118 | sub is_dynamic { $Is_Dynamic; } | ||||
119 | |||||
120 | |||||
121 | sub AUTOLOAD { | ||||
122 | my $self = $_[0]; | ||||
123 | my $attr = $Text::CSV::AUTOLOAD; | ||||
124 | $attr =~ s/.*:://; | ||||
125 | |||||
126 | return if $attr =~ /^[A-Z]+$/; | ||||
127 | Carp::croak( "Can't locate method $attr" ) unless $attr =~ /^_/; | ||||
128 | |||||
129 | my $pkg = $Text::CSV::Worker; | ||||
130 | |||||
131 | my $method = "$pkg\::$attr"; | ||||
132 | |||||
133 | $Text::CSV::DEBUG and Carp::carp("'$attr' is private method, so try to autoload..."); | ||||
134 | |||||
135 | local $^W; | ||||
136 | 3 | 310µs | 2 | 55µs | # spent 34µs (12+21) within Text::CSV::BEGIN@136 which was called:
# once (12µs+21µs) by C4::Members::Attributes::BEGIN@23 at line 136 # spent 34µs making 1 call to Text::CSV::BEGIN@136
# spent 21µs making 1 call to strict::unimport |
137 | |||||
138 | *{"Text::CSV::$attr"} = *{"$pkg\::$attr"}; | ||||
139 | |||||
140 | goto &$attr; | ||||
141 | } | ||||
142 | |||||
- - | |||||
145 | # spent 3.91ms (83µs+3.82) within Text::CSV::_load_xs which was called:
# once (83µs+3.82ms) by C4::Members::Attributes::BEGIN@23 at line 58 | ||||
146 | 7 | 81µs | my $opt = shift; | ||
147 | |||||
148 | $Text::CSV::DEBUG and Carp::carp "Load $Module_XS."; | ||||
149 | |||||
150 | eval qq| use $Module_XS $XS_Version |; # spent 198µs executing statements in string eval # includes 3.16ms spent executing 1 call to 1 sub defined therein. | ||||
151 | |||||
152 | if ($@) { | ||||
153 | if (defined $opt and $opt & $Install_Dont_Die) { | ||||
154 | $Text::CSV::DEBUG and Carp::carp "Can't load $Module_XS...($@)"; | ||||
155 | return 0; | ||||
156 | } | ||||
157 | Carp::croak $@; | ||||
158 | } | ||||
159 | |||||
160 | push @Text::CSV::ISA, 'Text::CSV_XS'; | ||||
161 | |||||
162 | 1 | 2µs | unless (defined $opt and $opt & $Install_Only) { | ||
163 | 1 | 120µs | _set_methods( $Text::CSV::Worker = $Module_XS ); # spent 120µs making 1 call to Text::CSV::_set_methods | ||
164 | } | ||||
165 | |||||
166 | return 1; | ||||
167 | }; | ||||
168 | |||||
169 | |||||
170 | sub _load_pp { | ||||
171 | my $opt = shift; | ||||
172 | |||||
173 | $Text::CSV::DEBUG and Carp::carp "Load $Module_PP."; | ||||
174 | |||||
175 | eval qq| require $Module_PP |; | ||||
176 | if ($@) { | ||||
177 | Carp::croak $@; | ||||
178 | } | ||||
179 | |||||
180 | push @Text::CSV::ISA, 'Text::CSV_PP'; | ||||
181 | |||||
182 | unless (defined $opt and $opt & $Install_Only) { | ||||
183 | _set_methods( $Text::CSV::Worker = $Module_PP ); | ||||
184 | } | ||||
185 | }; | ||||
186 | |||||
- - | |||||
190 | # spent 120µs within Text::CSV::_set_methods which was called:
# once (120µs+0s) by Text::CSV::_load_xs at line 163 | ||||
191 | 5 | 13µs | my $class = shift; | ||
192 | |||||
193 | #return; | ||||
194 | |||||
195 | local $^W; | ||||
196 | 3 | 152µs | 2 | 38µs | # spent 24µs (11+14) within Text::CSV::BEGIN@196 which was called:
# once (11µs+14µs) by C4::Members::Attributes::BEGIN@23 at line 196 # spent 24µs making 1 call to Text::CSV::BEGIN@196
# spent 14µs making 1 call to strict::unimport |
197 | |||||
198 | for my $method (@PublicMethods) { | ||||
199 | 37 | 103µs | *{"Text::CSV::$method"} = \&{"$class\::$method"}; | ||
200 | } | ||||
201 | |||||
202 | if ($Text::CSV::Worker eq $Module_XS) { | ||||
203 | for my $method (@UndocumentedXSMethods) { | ||||
204 | 3 | 8µs | *{"Text::CSV::$method"} = \&{"$Module_XS\::$method"}; | ||
205 | } | ||||
206 | } | ||||
207 | |||||
208 | if ($Text::CSV::Worker eq $Module_PP) { | ||||
209 | for my $method (@UndocumentedPPMethods) { | ||||
210 | *{"Text::CSV::$method"} = \&{"$Module_PP\::$method"}; | ||||
211 | } | ||||
212 | } | ||||
213 | |||||
214 | } | ||||
215 | |||||
- - | |||||
218 | 1 | 25µs | 1; | ||
219 | __END__ |