← 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/File/Spec/Win32.pm
StatementsExecuted 7137 statements in 46.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3605231.2ms31.2msFile::Spec::Win32::::splitpathFile::Spec::Win32::splitpath
8738115.6ms15.6msFile::Spec::Win32::::CORE:matchFile::Spec::Win32::CORE:match (opcode)
1110s0sFile::Spec::Win32::::BEGIN@3File::Spec::Win32::BEGIN@3
1110s0sFile::Spec::Win32::::BEGIN@5File::Spec::Win32::BEGIN@5
575510s0sFile::Spec::Win32::::CORE:regcompFile::Spec::Win32::CORE:regcomp (opcode)
2233810s0sFile::Spec::Win32::::CORE:substFile::Spec::Win32::CORE:subst (opcode)
269310s15.6msFile::Spec::Win32::::_canon_catFile::Spec::Win32::_canon_cat
0000s0sFile::Spec::Win32::::_sameFile::Spec::Win32::_same
92420s0sFile::Spec::Win32::::canonpathFile::Spec::Win32::canonpath
0000s0sFile::Spec::Win32::::case_tolerantFile::Spec::Win32::case_tolerant
902230s0sFile::Spec::Win32::::catdirFile::Spec::Win32::catdir
87330s15.6msFile::Spec::Win32::::catfileFile::Spec::Win32::catfile
0000s0sFile::Spec::Win32::::catpathFile::Spec::Win32::catpath
0000s0sFile::Spec::Win32::::devnullFile::Spec::Win32::devnull
22320s0sFile::Spec::Win32::::file_name_is_absoluteFile::Spec::Win32::file_name_is_absolute
3110s0sFile::Spec::Win32::::pathFile::Spec::Win32::path
0000s0sFile::Spec::Win32::::rel2absFile::Spec::Win32::rel2abs
2220s0sFile::Spec::Win32::::rootdirFile::Spec::Win32::rootdir
15110s0sFile::Spec::Win32::::splitdirFile::Spec::Win32::splitdir
0000s0sFile::Spec::Win32::::tmpdirFile::Spec::Win32::tmpdir
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package File::Spec::Win32;
2
320s20s
# spent 0s within File::Spec::Win32::BEGIN@3 which was called: # once (0s+0s) by File::Path::BEGIN@8 at line 3
use strict;
# spent 0s making 1 call to File::Spec::Win32::BEGIN@3 # spent 0s making 1 call to strict::import
4
520s20s
# spent 0s within File::Spec::Win32::BEGIN@5 which was called: # once (0s+0s) by File::Path::BEGIN@8 at line 5
use vars qw(@ISA $VERSION);
# spent 0s making 1 call to File::Spec::Win32::BEGIN@5 # spent 0s making 1 call to vars::import
610srequire File::Spec::Unix;
7
810s$VERSION = '3.48_01';
910s$VERSION =~ tr/_//;
10
1110s@ISA = qw(File::Spec::Unix);
12
13# Some regexes we use for path splitting
1410smy $DRIVE_RX = '[a-zA-Z]:';
1510smy $UNC_RX = '(?:\\\\\\\\|//)[^\\\\/]+[\\\\/][^\\\\/]+';
1610smy $VOL_RX = "(?:$DRIVE_RX|$UNC_RX)";
17
18
19=head1 NAME
20
21File::Spec::Win32 - methods for Win32 file specs
22
23=head1 SYNOPSIS
24
25 require File::Spec::Win32; # Done internally by File::Spec if needed
26
27=head1 DESCRIPTION
28
29See File::Spec::Unix for a documentation of the methods provided
30there. This package overrides the implementation of these methods, not
31the semantics.
32
33=over 4
34
35=item devnull
36
37Returns a string representation of the null device.
38
39=cut
40
41sub devnull {
42 return "nul";
43}
44
4520s
# spent 0s within File::Spec::Win32::rootdir which was called 2 times, avg 0s/call: # once (0s+0s) by main::BEGIN@1 at line 20 of ExtUtils/MM_Any.pm # once (0s+0s) by main::BEGIN@1 at line 101 of ExtUtils/MM_Unix.pm
sub rootdir { '\\' }
46
47
48=item tmpdir
49
50Returns a string representation of the first existing directory
51from the following list:
52
53 $ENV{TMPDIR}
54 $ENV{TEMP}
55 $ENV{TMP}
56 SYS:/temp
57 C:\system\temp
58 C:/temp
59 /tmp
60 /
61
62The SYS:/temp is preferred in Novell NetWare and the C:\system\temp
63for Symbian (the File::Spec::Win32 is used also for those platforms).
64
65If running under taint mode, and if the environment
66variables are tainted, they are not used.
67
68=cut
69
70sub tmpdir {
71 my $tmpdir = $_[0]->_cached_tmpdir(qw(TMPDIR TEMP TMP));
72 return $tmpdir if defined $tmpdir;
73 $tmpdir = $_[0]->_tmpdir( map( $ENV{$_}, qw(TMPDIR TEMP TMP) ),
74 'SYS:/temp',
75 'C:\system\temp',
76 'C:/temp',
77 '/tmp',
78 '/' );
79 $_[0]->_cache_tmpdir($tmpdir, qw(TMPDIR TEMP TMP));
80}
81
82=item case_tolerant
83
84MSWin32 case-tolerance depends on GetVolumeInformation() $ouFsFlags == FS_CASE_SENSITIVE,
85indicating the case significance when comparing file specifications.
86Since XP FS_CASE_SENSITIVE is effectively disabled for the NT subsubsystem.
87See http://cygwin.com/ml/cygwin/2007-07/msg00891.html
88Default: 1
89
90=cut
91
92sub case_tolerant {
93 eval { require Win32API::File; } or return 1;
94 my $drive = shift || "C:";
95 my $osFsType = "\0"x256;
96 my $osVolName = "\0"x256;
97 my $ouFsFlags = 0;
98 Win32API::File::GetVolumeInformation($drive, $osVolName, 256, [], [], $ouFsFlags, $osFsType, 256 );
99 if ($ouFsFlags & Win32API::File::FS_CASE_SENSITIVE()) { return 0; }
100 else { return 1; }
101}
102
103=item file_name_is_absolute
104
105As of right now, this returns 2 if the path is absolute with a
106volume, 1 if it's absolute with no volume, 0 otherwise.
107
108=cut
109
110
# spent 0s within File::Spec::Win32::file_name_is_absolute which was called 22 times, avg 0s/call: # 18 times (0s+0s) by ExtUtils::MakeMaker::new at line 606 of ExtUtils/MakeMaker.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::init_PERL at line 1967 of ExtUtils/MM_Unix.pm, avg 0s/call # once (0s+0s) by ExtUtils::MM_Unix::find_perl at line 1055 of ExtUtils/MM_Unix.pm
sub file_name_is_absolute {
111
112220s my ($self,$file) = @_;
113
114220s440s if ($file =~ m{^($VOL_RX)}o) {
# spent 0s making 22 calls to File::Spec::Win32::CORE:match, avg 0s/call # spent 0s making 22 calls to File::Spec::Win32::CORE:regcomp, avg 0s/call
11580s my $vol = $1;
11680s320s return ($vol =~ m{^$UNC_RX}o ? 2
# spent 0s making 16 calls to File::Spec::Win32::CORE:match, avg 0s/call # spent 0s making 16 calls to File::Spec::Win32::CORE:regcomp, avg 0s/call
117 : $file =~ m{^$DRIVE_RX[\\/]}o ? 2
118 : 0);
119 }
120140s140s return $file =~ m{^[\\/]} ? 1 : 0;
# spent 0s making 14 calls to File::Spec::Win32::CORE:match, avg 0s/call
121}
122
123=item catfile
124
125Concatenate one or more directory names and a filename to form a
126complete path ending with a filename
127
128=cut
129
130
# spent 15.6ms (0s+15.6) within File::Spec::Win32::catfile which was called 87 times, avg 179µs/call: # 83 times (0s+15.6ms) by ExtUtils::MM_Any::catfile at line 2624 of ExtUtils/MM_Any.pm, avg 188µs/call # 3 times (0s+0s) by ExtUtils::MM_Unix::constants at line 465 of ExtUtils/MM_Unix.pm, avg 0s/call # once (0s+0s) by ExtUtils::MakeMaker::check_manifest at line 59 of ExtUtils/Manifest.pm
sub catfile {
131870s shift;
132
133 # Legacy / compatibility support
134 #
135870s shift, return _canon_cat( "/", @_ )
136 if $_[0] eq "";
137
138 # Compatibility with File::Spec <= 3.26:
139 # catfile('A:', 'foo') should return 'A:\foo'.
140870s1740s return _canon_cat( ($_[0].'\\'), @_[1..$#_] )
# spent 0s making 87 calls to File::Spec::Win32::CORE:match, avg 0s/call # spent 0s making 87 calls to File::Spec::Win32::CORE:regcomp, avg 0s/call
141 if $_[0] =~ m{^$DRIVE_RX\z}o;
142
143870s8715.6ms return _canon_cat( @_ );
# spent 15.6ms making 87 calls to File::Spec::Win32::_canon_cat, avg 179µs/call
144}
145
146
# spent 0s within File::Spec::Win32::catdir which was called 90 times, avg 0s/call: # 24 times (0s+0s) by ExtUtils::MM_Unix::init_main at line 1642 of ExtUtils/MM_Unix.pm, avg 0s/call # 14 times (0s+0s) by ExtUtils::MakeMaker::new at line 606 of ExtUtils/MakeMaker.pm, avg 0s/call # 12 times (0s+0s) by ExtUtils::MM_Unix::tool_xsubpp at line 3589 of ExtUtils/MM_Unix.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MakeMaker::check_hints at line 1026 of ExtUtils/MakeMaker.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::tool_xsubpp at line 3597 of ExtUtils/MM_Unix.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::pm_to_blib at line 2904 of ExtUtils/MM_Unix.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::init_main at line 1693 of ExtUtils/MM_Unix.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::init_main at line 1606 of ExtUtils/MM_Unix.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::init_INST at line 1772 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::init_INST at line 1771 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::init_INST at line 1770 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::init_INST at line 1774 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::_perl_header_files at line 2852 of ExtUtils/MM_Any.pm, avg 0s/call # 2 times (0s+0s) by ExtUtils::MakeMaker::eval_in_subdirs at line 227 of ExtUtils/MakeMaker.pm, avg 0s/call # once (0s+0s) by ExtUtils::MM_Unix::install at line 2129 of ExtUtils/MM_Unix.pm # once (0s+0s) by ExtUtils::MM_Unix::install at line 2148 of ExtUtils/MM_Unix.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1777 of ExtUtils/MM_Any.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1779 of ExtUtils/MM_Any.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1756 of ExtUtils/MM_Any.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1765 of ExtUtils/MM_Any.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1755 of ExtUtils/MM_Any.pm # once (0s+0s) by ExtUtils::MM_Any::init_INST at line 1780 of ExtUtils/MM_Any.pm
sub catdir {
147900s shift;
148
149 # Legacy / compatibility support
150 #
151900s return ""
152 unless @_;
153900s shift, return _canon_cat( "/", @_ )
154 if $_[0] eq "";
155
156 # Compatibility with File::Spec <= 3.26:
157 # catdir('A:', 'foo') should return 'A:\foo'.
158900s1800s return _canon_cat( ($_[0].'\\'), @_[1..$#_] )
# spent 0s making 90 calls to File::Spec::Win32::CORE:match, avg 0s/call # spent 0s making 90 calls to File::Spec::Win32::CORE:regcomp, avg 0s/call
159 if $_[0] =~ m{^$DRIVE_RX\z}o;
160
161900s900s return _canon_cat( @_ );
# spent 0s making 90 calls to File::Spec::Win32::_canon_cat, avg 0s/call
162}
163
164
# spent 0s within File::Spec::Win32::path which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::init_PERL at line 1900 of ExtUtils/MM_Unix.pm, avg 0s/call
sub path {
16530s my @path = split(';', $ENV{PATH});
16630s1530s s/"//g for @path;
# spent 0s making 153 calls to File::Spec::Win32::CORE:subst, avg 0s/call
16730s @path = grep length, @path;
16830s unshift(@path, ".");
16930s return @path;
170}
171
172=item canonpath
173
174No physical check on the filesystem, but a logical cleanup of a
175path. On UNIX eliminated successive slashes and successive "/.".
176On Win32 makes
177
178 dir1\dir2\dir3\..\..\dir4 -> \dir\dir4 and even
179 dir1\dir2\dir3\...\dir4 -> \dir\dir4
180
181=cut
182
183
# spent 0s within File::Spec::Win32::canonpath which was called 92 times, avg 0s/call: # 83 times (0s+0s) by ExtUtils::MM_Any::catfile at line 2624 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::arch_check at line 2582 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::arch_check at line 2581 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Unix::init_PERL at line 1907 of ExtUtils/MM_Unix.pm, avg 0s/call
sub canonpath {
184 # Legacy / compatibility support
185 #
186920s return $_[1] if !defined($_[1]) or $_[1] eq '';
187920s920s return _canon_cat( $_[1] );
# spent 0s making 92 calls to File::Spec::Win32::_canon_cat, avg 0s/call
188}
189
190=item splitpath
191
192 ($volume,$directories,$file) = File::Spec->splitpath( $path );
193 ($volume,$directories,$file) = File::Spec->splitpath( $path,
194 $no_file );
195
196Splits a path into volume, directory, and filename portions. Assumes that
197the last file is a path unless the path ends in '\\', '\\.', '\\..'
198or $no_file is true. On Win32 this means that $no_file true makes this return
199( $volume, $path, '' ).
200
201Separators accepted are \ and /.
202
203Volumes can be drive letters or UNC sharenames (\\server\share).
204
205The results can be passed to L</catpath> to get back a path equivalent to
206(usually identical to) the original path.
207
208=cut
209
210
# spent 31.2ms within File::Spec::Win32::splitpath which was called 360 times, avg 87µs/call: # 336 times (31.2ms+0s) by ExtUtils::MM_Any::is_make_type at line 207 of ExtUtils/MM_Any.pm, avg 93µs/call # 15 times (0s+0s) by ExtUtils::MM_Any::libscan at line 2737 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::arch_check at line 2578 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MM_Any::arch_check at line 2579 of ExtUtils/MM_Any.pm, avg 0s/call # 3 times (0s+0s) by ExtUtils::MakeMaker::flush at line 1160 of ExtUtils/MakeMaker.pm, avg 0s/call
sub splitpath {
2113600s my ($self,$path, $nofile) = @_;
2123600s my ($volume,$directory,$file) = ('','','');
2133600s if ( $nofile ) {
214 $path =~
215 m{^ ( $VOL_RX ? ) (.*) }sox;
216 $volume = $1;
217 $directory = $2;
218 }
219 else {
22036015.6ms7200s $path =~
# spent 0s making 360 calls to File::Spec::Win32::CORE:match, avg 0s/call # spent 0s making 360 calls to File::Spec::Win32::CORE:regcomp, avg 0s/call
221 m{^ ( $VOL_RX ? )
222 ( (?:.*[\\/](?:\.\.?\Z(?!\n))?)? )
223 (.*)
224 }sox;
2253600s $volume = $1;
22636015.6ms $directory = $2;
2273600s $file = $3;
228 }
229
2303600s return ($volume,$directory,$file);
231}
232
233
234=item splitdir
235
236The opposite of L<catdir()|File::Spec/catdir>.
237
238 @dirs = File::Spec->splitdir( $directories );
239
240$directories must be only the directory portion of the path on systems
241that have the concept of a volume or that have path syntax that differentiates
242files from directories.
243
244Unlike just splitting the directories on the separator, leading empty and
245trailing directory entries can be returned, because these are significant
246on some OSs. So,
247
248 File::Spec->splitdir( "/a/b/c" );
249
250Yields:
251
252 ( '', 'a', 'b', '', 'c', '' )
253
254=cut
255
256
# spent 0s within File::Spec::Win32::splitdir which was called 15 times, avg 0s/call: # 15 times (0s+0s) by ExtUtils::MM_Any::libscan at line 2738 of ExtUtils/MM_Any.pm, avg 0s/call
sub splitdir {
257150s my ($self,$directories) = @_ ;
258 #
259 # split() likes to forget about trailing null fields, so here we
260 # check to be sure that there will not be any before handling the
261 # simple case.
262 #
263150s150s if ( $directories !~ m|[\\/]\Z(?!\n)| ) {
# spent 0s making 15 calls to File::Spec::Win32::CORE:match, avg 0s/call
264150s return split( m|[\\/]|, $directories );
265 }
266 else {
267 #
268 # since there was a trailing separator, add a file name to the end,
269 # then do the split, then replace it with ''.
270 #
271 my( @directories )= split( m|[\\/]|, "${directories}dummy" ) ;
272 $directories[ $#directories ]= '' ;
273 return @directories ;
274 }
275}
276
277
278=item catpath
279
280Takes volume, directory and file portions and returns an entire path. Under
281Unix, $volume is ignored, and this is just like catfile(). On other OSs,
282the $volume become significant.
283
284=cut
285
286sub catpath {
287 my ($self,$volume,$directory,$file) = @_;
288
289 # If it's UNC, make sure the glue separator is there, reusing
290 # whatever separator is first in the $volume
291 my $v;
292 $volume .= $v
293 if ( (($v) = $volume =~ m@^([\\/])[\\/][^\\/]+[\\/][^\\/]+\Z(?!\n)@s) &&
294 $directory =~ m@^[^\\/]@s
295 ) ;
296
297 $volume .= $directory ;
298
299 # If the volume is not just A:, make sure the glue separator is
300 # there, reusing whatever separator is first in the $volume if possible.
301 if ( $volume !~ m@^[a-zA-Z]:\Z(?!\n)@s &&
302 $volume =~ m@[^\\/]\Z(?!\n)@ &&
303 $file =~ m@[^\\/]@
304 ) {
305 $volume =~ m@([\\/])@ ;
306 my $sep = $1 ? $1 : '\\' ;
307 $volume .= $sep ;
308 }
309
310 $volume .= $file ;
311
312 return $volume ;
313}
314
315sub _same {
316 lc($_[1]) eq lc($_[2]);
317}
318
319sub rel2abs {
320 my ($self,$path,$base ) = @_;
321
322 my $is_abs = $self->file_name_is_absolute($path);
323
324 # Check for volume (should probably document the '2' thing...)
325 return $self->canonpath( $path ) if $is_abs == 2;
326
327 if ($is_abs) {
328 # It's missing a volume, add one
329 my $vol = ($self->splitpath( $self->_cwd() ))[0];
330 return $self->canonpath( $vol . $path );
331 }
332
333 if ( !defined( $base ) || $base eq '' ) {
334 require Cwd ;
335 $base = Cwd::getdcwd( ($self->splitpath( $path ))[0] ) if defined &Cwd::getdcwd ;
336 $base = $self->_cwd() unless defined $base ;
337 }
338 elsif ( ! $self->file_name_is_absolute( $base ) ) {
339 $base = $self->rel2abs( $base ) ;
340 }
341 else {
342 $base = $self->canonpath( $base ) ;
343 }
344
345 my ( $path_directories, $path_file ) =
346 ($self->splitpath( $path, 1 ))[1,2] ;
347
348 my ( $base_volume, $base_directories ) =
349 $self->splitpath( $base, 1 ) ;
350
351 $path = $self->catpath(
352 $base_volume,
353 $self->catdir( $base_directories, $path_directories ),
354 $path_file
355 ) ;
356
357 return $self->canonpath( $path ) ;
358}
359
360=back
361
362=head2 Note For File::Spec::Win32 Maintainers
363
364Novell NetWare inherits its File::Spec behaviour from File::Spec::Win32.
365
366=head1 COPYRIGHT
367
368Copyright (c) 2004,2007 by the Perl 5 Porters. All rights reserved.
369
370This program is free software; you can redistribute it and/or modify
371it under the same terms as Perl itself.
372
373=head1 SEE ALSO
374
375See L<File::Spec> and L<File::Spec::Unix>. This package overrides the
376implementation of these methods, not the semantics.
377
378=cut
379
380
381sub _canon_cat # @path -> path
382
# spent 15.6ms (0s+15.6) within File::Spec::Win32::_canon_cat which was called 269 times, avg 58µs/call: # 92 times (0s+0s) by File::Spec::Win32::canonpath at line 187, avg 0s/call # 90 times (0s+0s) by File::Spec::Win32::catdir at line 161, avg 0s/call # 87 times (0s+15.6ms) by File::Spec::Win32::catfile at line 143, avg 179µs/call
{
3832690s my ($first, @rest) = @_;
384
3852690s6510s my $volume = $first =~ s{ \A ([A-Za-z]:) ([\\/]?) }{}x # drive letter
# spent 0s making 651 calls to File::Spec::Win32::CORE:subst, avg 0s/call
386 ? ucfirst( $1 ).( $2 ? "\\" : "" )
387 : $first =~ s{ \A (?:\\\\|//) ([^\\/]+)
388 (?: [\\/] ([^\\/]+) )?
389 [\\/]? }{}xs # UNC volume
390 ? "\\\\$1".( defined $2 ? "\\$2" : "" )."\\"
391 : $first =~ s{ \A [\\/] }{}x # root dir
392 ? "\\"
393 : "";
3942690s my $path = join "\\", $first, @rest;
395
3962690s $path =~ tr#\\/#\\\\#s; # xx/yy --> xx\yy & xx\\yy --> xx\yy
397
398 # xx/././yy --> xx/yy
3992690s2690s $path =~ s{(?:
# spent 0s making 269 calls to File::Spec::Win32::CORE:subst, avg 0s/call
400 (?:\A|\\) # at begin or after a slash
401 \.
402 (?:\\\.)* # and more
403 (?:\\|\z) # at end or followed by slash
404 )+ # performance boost -- I do not know why
405 }{\\}gx;
406
407 # XXX I do not know whether more dots are supported by the OS supporting
408 # this ... annotation (NetWare or symbian but not MSWin32).
409 # Then .... could easily become ../../.. etc:
410 # Replace \.\.\. by (\.\.\.+) and substitute with
411 # { $1 . ".." . "\\.." x (length($2)-2) }gex
412 # ... --> ../..
4132690s2690s $path =~ s{ (\A|\\) # at begin or after a slash
# spent 0s making 269 calls to File::Spec::Win32::CORE:subst, avg 0s/call
414 \.\.\.
415 (?=\\|\z) # at end or followed by slash
416 }{$1..\\..}gx;
417 # xx\yy\..\zz --> xx\zz
4182690s2690s while ( $path =~ s{(?:
# spent 0s making 269 calls to File::Spec::Win32::CORE:subst, avg 0s/call
419 (?:\A|\\) # at begin or after a slash
420 [^\\]+ # rip this 'yy' off
421 \\\.\.
422 (?<!\A\.\.\\\.\.) # do *not* replace ^..\..
423 (?<!\\\.\.\\\.\.) # do *not* replace \..\..
424 (?:\\|\z) # at end or followed by slash
425 )+ # performance boost -- I do not know why
426 }{\\}sx ) {}
427
4282690s2690s $path =~ s#\A\\##; # \xx --> xx NOTE: this is *not* root
# spent 0s making 269 calls to File::Spec::Win32::CORE:subst, avg 0s/call
4292690s2690s $path =~ s#\\\z##; # xx\ --> xx
# spent 0s making 269 calls to File::Spec::Win32::CORE:subst, avg 0s/call
430
43126915.6ms26915.6ms if ( $volume =~ m#\\\z# )
# spent 15.6ms making 269 calls to File::Spec::Win32::CORE:match, avg 58µs/call
432 { # <vol>\.. --> <vol>\
433840s840s $path =~ s{ \A # at begin
# spent 0s making 84 calls to File::Spec::Win32::CORE:subst, avg 0s/call
434 \.\.
435 (?:\\\.\.)* # and more
436 (?:\\|\z) # at end or followed by slash
437 }{}x;
438
439840s return $1 # \\HOST\SHARE\ --> \\HOST\SHARE
440 if $path eq ""
441 and $volume =~ m#\A(\\\\.*)\\\z#s;
442 }
4432690s return $path ne "" || $volume ? $volume.$path : ".";
444}
445
44610s1;
 
# spent 15.6ms within File::Spec::Win32::CORE:match which was called 873 times, avg 18µs/call: # 360 times (0s+0s) by File::Spec::Win32::splitpath at line 220, avg 0s/call # 269 times (15.6ms+0s) by File::Spec::Win32::_canon_cat at line 431, avg 58µs/call # 90 times (0s+0s) by File::Spec::Win32::catdir at line 158, avg 0s/call # 87 times (0s+0s) by File::Spec::Win32::catfile at line 140, avg 0s/call # 22 times (0s+0s) by File::Spec::Win32::file_name_is_absolute at line 114, avg 0s/call # 16 times (0s+0s) by File::Spec::Win32::file_name_is_absolute at line 116, avg 0s/call # 15 times (0s+0s) by File::Spec::Win32::splitdir at line 263, avg 0s/call # 14 times (0s+0s) by File::Spec::Win32::file_name_is_absolute at line 120, avg 0s/call
sub File::Spec::Win32::CORE:match; # opcode
# spent 0s within File::Spec::Win32::CORE:regcomp which was called 575 times, avg 0s/call: # 360 times (0s+0s) by File::Spec::Win32::splitpath at line 220, avg 0s/call # 90 times (0s+0s) by File::Spec::Win32::catdir at line 158, avg 0s/call # 87 times (0s+0s) by File::Spec::Win32::catfile at line 140, avg 0s/call # 22 times (0s+0s) by File::Spec::Win32::file_name_is_absolute at line 114, avg 0s/call # 16 times (0s+0s) by File::Spec::Win32::file_name_is_absolute at line 116, avg 0s/call
sub File::Spec::Win32::CORE:regcomp; # opcode
# spent 0s within File::Spec::Win32::CORE:subst which was called 2233 times, avg 0s/call: # 651 times (0s+0s) by File::Spec::Win32::_canon_cat at line 385, avg 0s/call # 269 times (0s+0s) by File::Spec::Win32::_canon_cat at line 399, avg 0s/call # 269 times (0s+0s) by File::Spec::Win32::_canon_cat at line 428, avg 0s/call # 269 times (0s+0s) by File::Spec::Win32::_canon_cat at line 418, avg 0s/call # 269 times (0s+0s) by File::Spec::Win32::_canon_cat at line 429, avg 0s/call # 269 times (0s+0s) by File::Spec::Win32::_canon_cat at line 413, avg 0s/call # 153 times (0s+0s) by File::Spec::Win32::path at line 166, avg 0s/call # 84 times (0s+0s) by File::Spec::Win32::_canon_cat at line 433, avg 0s/call
sub File::Spec::Win32::CORE:subst; # opcode