← Index
NYTProf Performance Profile   « line view »
For /Users/brian/bin/perls/cpan5.26.1
  Run on Sat Dec 30 01:41:10 2017
Reported on Sat Dec 30 01:44:15 2017

Filename/usr/local/perls/perl-5.26.1/lib/site_perl/5.26.1/URI/file.pm
StatementsExecuted 44 statements in 1.55ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
2111.62ms3.34msURI::file::::os_classURI::file::os_class
21179µs527µsURI::file::::canonicalURI::file::canonical
11132µs38µsURI::file::::BEGIN@3URI::file::BEGIN@3
21130µs3.79msURI::file::::fileURI::file::file
11124µs89µsURI::file::::BEGIN@9URI::file::BEGIN@9
11122µs6.31msURI::file::::BEGIN@6URI::file::BEGIN@6
11118µs45µsURI::file::::BEGIN@31URI::file::BEGIN@31
11113µs27µsURI::file::::BEGIN@4URI::file::BEGIN@4
0000s0sURI::file::::cwdURI::file::cwd
0000s0sURI::file::::dirURI::file::dir
0000s0sURI::file::::hostURI::file::host
0000s0sURI::file::::newURI::file::new
0000s0sURI::file::::new_absURI::file::new_abs
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package URI::file;
2
3247µs244µs
# spent 38µs (32+6) within URI::file::BEGIN@3 which was called: # once (32µs+6µs) by URI::implementor at line 3
use strict;
# spent 38µs making 1 call to URI::file::BEGIN@3 # spent 6µs making 1 call to strict::import
4251µs241µs
# spent 27µs (13+14) within URI::file::BEGIN@4 which was called: # once (13µs+14µs) by URI::implementor at line 4
use warnings;
# spent 27µs making 1 call to URI::file::BEGIN@4 # spent 14µs making 1 call to warnings::import
5
6290µs212.6ms
# spent 6.31ms (22µs+6.29) within URI::file::BEGIN@6 which was called: # once (22µs+6.29ms) by URI::implementor at line 6
use parent 'URI::_generic';
# spent 6.31ms making 1 call to URI::file::BEGIN@6 # spent 6.29ms making 1 call to parent::import
711µsour $VERSION = "4.21";
8
92203µs2154µs
# spent 89µs (24+65) within URI::file::BEGIN@9 which was called: # once (24µs+65µs) by URI::implementor at line 9
use URI::Escape qw(uri_unescape);
# spent 89µs making 1 call to URI::file::BEGIN@9 # spent 65µs making 1 call to Exporter::import
10
1110sour $DEFAULT_AUTHORITY = "";
12
13# Map from $^O values to implementation classes. The Unix
14# class is the default.
15123µsour %OS_CLASS = (
16 os2 => "OS2",
17 mac => "Mac",
18 MacOS => "Mac",
19 MSWin32 => "Win32",
20 win32 => "Win32",
21 msdos => "FAT",
22 dos => "FAT",
23 qnx => "QNX",
24);
25
26sub os_class
27
# spent 3.34ms (1.62+1.72) within URI::file::os_class which was called 2 times, avg 1.67ms/call: # 2 times (1.62ms+1.72ms) by URI::file::file at line 96, avg 1.67ms/call
{
2825µs my($OS) = shift || $^O;
29
3025µs my $class = "URI::file::" . ($OS_CLASS{$OS} || "Unix");
312936µs272µs
# spent 45µs (18+27) within URI::file::BEGIN@31 which was called: # once (18µs+27µs) by URI::implementor at line 31
no strict 'refs';
# spent 45µs making 1 call to URI::file::BEGIN@31 # spent 27µs making 1 call to strict::unimport
32222µs unless (%{"$class\::"}) {
33163µs eval "require $class";
# spent 934µs executing statements in string eval
3411µs die $@ if $@;
35 }
36214µs $class;
37}
38
39sub host { uri_unescape(shift->authority(@_)) }
40
41sub new
42{
43 my($class, $path, $os) = @_;
44 os_class($os)->new($path);
45}
46
47sub new_abs
48{
49 my $class = shift;
50 my $file = $class->new(@_);
51 return $file->abs($class->cwd) unless $$file =~ /^file:/;
52 $file;
53}
54
55sub cwd
56{
57 my $class = shift;
58 require Cwd;
59 my $cwd = Cwd::cwd();
60 $cwd = VMS::Filespec::unixpath($cwd) if $^O eq 'VMS';
61 $cwd = $class->new($cwd);
62 $cwd .= "/" unless substr($cwd, -1, 1) eq "/";
63 $cwd;
64}
65
66
# spent 527µs (79+448) within URI::file::canonical which was called 2 times, avg 264µs/call: # 2 times (79µs+448µs) by URI::URL::new at line 25 of URI/URL.pm, avg 264µs/call
sub canonical {
6722µs my $self = shift;
68211µs2203µs my $other = $self->SUPER::canonical;
# spent 203µs making 2 calls to URI::canonical, avg 102µs/call
69
70211µs2103µs my $scheme = $other->scheme;
# spent 103µs making 2 calls to URI::scheme, avg 52µs/call
71213µs2142µs my $auth = $other->authority;
# spent 142µs making 2 calls to URI::_generic::authority, avg 71µs/call
7221µs return $other if !defined($scheme) && !defined($auth); # relative
73
7423µs if (!defined($auth) ||
75 $auth eq "" ||
76 lc($auth) eq "localhost" ||
77 (defined($DEFAULT_AUTHORITY) && lc($auth) eq lc($DEFAULT_AUTHORITY))
78 )
79 {
80 # avoid cloning if $auth already match
8122µs if ((defined($auth) || defined($DEFAULT_AUTHORITY)) &&
82 (!defined($auth) || !defined($DEFAULT_AUTHORITY) || $auth ne $DEFAULT_AUTHORITY)
83 )
84 {
85 $other = $other->clone if $self == $other;
86 $other->authority($DEFAULT_AUTHORITY);
87 }
88 }
89
9028µs $other;
91}
92
93sub file
94
# spent 3.79ms (30µs+3.75) within URI::file::file which was called 2 times, avg 1.89ms/call: # 2 times (30µs+3.75ms) by URI::WithBase::AUTOLOAD at line 53 of URI/WithBase.pm, avg 1.89ms/call
{
9523µs my($self, $os) = @_;
96221µs43.75ms os_class($os)->file($self);
# spent 3.34ms making 2 calls to URI::file::os_class, avg 1.67ms/call # spent 413µs making 2 calls to URI::file::Unix::file, avg 206µs/call
97}
98
99sub dir
100{
101 my($self, $os) = @_;
102 os_class($os)->dir($self);
103}
104
105113µs1;
106
107__END__