Filename | /usr/local/perls/perl-5.26.1/lib/site_perl/5.26.1/URI/file.pm |
Statements | Executed 44 statements in 1.55ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2 | 1 | 1 | 1.62ms | 3.34ms | os_class | URI::file::
2 | 1 | 1 | 79µs | 527µs | canonical | URI::file::
1 | 1 | 1 | 32µs | 38µs | BEGIN@3 | URI::file::
2 | 1 | 1 | 30µs | 3.79ms | file | URI::file::
1 | 1 | 1 | 24µs | 89µs | BEGIN@9 | URI::file::
1 | 1 | 1 | 22µs | 6.31ms | BEGIN@6 | URI::file::
1 | 1 | 1 | 18µs | 45µs | BEGIN@31 | URI::file::
1 | 1 | 1 | 13µs | 27µs | BEGIN@4 | URI::file::
0 | 0 | 0 | 0s | 0s | cwd | URI::file::
0 | 0 | 0 | 0s | 0s | dir | URI::file::
0 | 0 | 0 | 0s | 0s | host | URI::file::
0 | 0 | 0 | 0s | 0s | new | URI::file::
0 | 0 | 0 | 0s | 0s | new_abs | URI::file::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package URI::file; | ||||
2 | |||||
3 | 2 | 47µs | 2 | 44µ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 # spent 38µs making 1 call to URI::file::BEGIN@3
# spent 6µs making 1 call to strict::import |
4 | 2 | 51µs | 2 | 41µ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 # spent 27µs making 1 call to URI::file::BEGIN@4
# spent 14µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 90µs | 2 | 12.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 # spent 6.31ms making 1 call to URI::file::BEGIN@6
# spent 6.29ms making 1 call to parent::import |
7 | 1 | 1µs | our $VERSION = "4.21"; | ||
8 | |||||
9 | 2 | 203µs | 2 | 154µ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 # spent 89µs making 1 call to URI::file::BEGIN@9
# spent 65µs making 1 call to Exporter::import |
10 | |||||
11 | 1 | 0s | our $DEFAULT_AUTHORITY = ""; | ||
12 | |||||
13 | # Map from $^O values to implementation classes. The Unix | ||||
14 | # class is the default. | ||||
15 | 1 | 23µs | our %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 | |||||
26 | sub 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 | ||||
28 | 2 | 5µs | my($OS) = shift || $^O; | ||
29 | |||||
30 | 2 | 5µs | my $class = "URI::file::" . ($OS_CLASS{$OS} || "Unix"); | ||
31 | 2 | 936µs | 2 | 72µ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 # spent 45µs making 1 call to URI::file::BEGIN@31
# spent 27µs making 1 call to strict::unimport |
32 | 2 | 22µs | unless (%{"$class\::"}) { | ||
33 | 1 | 63µs | eval "require $class"; # spent 934µs executing statements in string eval | ||
34 | 1 | 1µs | die $@ if $@; | ||
35 | } | ||||
36 | 2 | 14µs | $class; | ||
37 | } | ||||
38 | |||||
39 | sub host { uri_unescape(shift->authority(@_)) } | ||||
40 | |||||
41 | sub new | ||||
42 | { | ||||
43 | my($class, $path, $os) = @_; | ||||
44 | os_class($os)->new($path); | ||||
45 | } | ||||
46 | |||||
47 | sub 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 | |||||
55 | sub 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 | ||||
67 | 2 | 2µs | my $self = shift; | ||
68 | 2 | 11µs | 2 | 203µs | my $other = $self->SUPER::canonical; # spent 203µs making 2 calls to URI::canonical, avg 102µs/call |
69 | |||||
70 | 2 | 11µs | 2 | 103µs | my $scheme = $other->scheme; # spent 103µs making 2 calls to URI::scheme, avg 52µs/call |
71 | 2 | 13µs | 2 | 142µs | my $auth = $other->authority; # spent 142µs making 2 calls to URI::_generic::authority, avg 71µs/call |
72 | 2 | 1µs | return $other if !defined($scheme) && !defined($auth); # relative | ||
73 | |||||
74 | 2 | 3µ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 | ||||
81 | 2 | 2µ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 | |||||
90 | 2 | 8µs | $other; | ||
91 | } | ||||
92 | |||||
93 | sub 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 | ||||
95 | 2 | 3µs | my($self, $os) = @_; | ||
96 | 2 | 21µs | 4 | 3.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 | |||||
99 | sub dir | ||||
100 | { | ||||
101 | my($self, $os) = @_; | ||||
102 | os_class($os)->dir($self); | ||||
103 | } | ||||
104 | |||||
105 | 1 | 13µs | 1; | ||
106 | |||||
107 | __END__ |