Filename | /usr/local/perls/perl-5.26.1/lib/site_perl/5.26.1/URI/file/Unix.pm |
Statements | Executed 73 statements in 797µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
2 | 1 | 1 | 135µs | 413µs | file | URI::file::Unix::
1 | 1 | 1 | 59µs | 69µs | BEGIN@3 | URI::file::Unix::
1 | 1 | 1 | 17µs | 40µs | BEGIN@4 | URI::file::Unix::
1 | 1 | 1 | 15µs | 1.55ms | BEGIN@6 | URI::file::Unix::
1 | 1 | 1 | 15µs | 66µs | BEGIN@8 | URI::file::Unix::
40 | 2 | 1 | 11µs | 11µs | CORE:match (opcode) | URI::file::Unix::
0 | 0 | 0 | 0s | 0s | _file_extract_path | URI::file::Unix::
0 | 0 | 0 | 0s | 0s | _file_is_absolute | URI::file::Unix::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package URI::file::Unix; | ||||
2 | |||||
3 | 2 | 56µs | 2 | 79µs | # spent 69µs (59+10) within URI::file::Unix::BEGIN@3 which was called:
# once (59µs+10µs) by URI::file::os_class at line 3 # spent 69µs making 1 call to URI::file::Unix::BEGIN@3
# spent 10µs making 1 call to strict::import |
4 | 2 | 49µs | 2 | 63µs | # spent 40µs (17+23) within URI::file::Unix::BEGIN@4 which was called:
# once (17µs+23µs) by URI::file::os_class at line 4 # spent 40µs making 1 call to URI::file::Unix::BEGIN@4
# spent 23µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 54µs | 2 | 3.08ms | # spent 1.55ms (15µs+1.53) within URI::file::Unix::BEGIN@6 which was called:
# once (15µs+1.53ms) by URI::file::os_class at line 6 # spent 1.55ms making 1 call to URI::file::Unix::BEGIN@6
# spent 1.53ms making 1 call to parent::import |
7 | |||||
8 | 2 | 466µs | 2 | 117µs | # spent 66µs (15+51) within URI::file::Unix::BEGIN@8 which was called:
# once (15µs+51µs) by URI::file::os_class at line 8 # spent 66µs making 1 call to URI::file::Unix::BEGIN@8
# spent 51µs making 1 call to Exporter::import |
9 | |||||
10 | 1 | 1µs | our $VERSION = '1.72'; | ||
11 | 1 | 25µs | $VERSION = eval $VERSION; # spent 3µs executing statements in string eval | ||
12 | |||||
13 | sub _file_extract_path | ||||
14 | { | ||||
15 | my($class, $path) = @_; | ||||
16 | |||||
17 | # tidy path | ||||
18 | $path =~ s,//+,/,g; | ||||
19 | $path =~ s,(/\.)+/,/,g; | ||||
20 | $path = "./$path" if $path =~ m,^[^:/]+:,,; # look like "scheme:" | ||||
21 | |||||
22 | return $path; | ||||
23 | } | ||||
24 | |||||
25 | sub _file_is_absolute { | ||||
26 | my($class, $path) = @_; | ||||
27 | return $path =~ m,^/,; | ||||
28 | } | ||||
29 | |||||
30 | sub file | ||||
31 | # spent 413µs (135+278) within URI::file::Unix::file which was called 2 times, avg 206µs/call:
# 2 times (135µs+278µs) by URI::file::file at line 96 of URI/file.pm, avg 206µs/call | ||||
32 | 2 | 2µs | my $class = shift; | ||
33 | 2 | 1µs | my $uri = shift; | ||
34 | 2 | 0s | my @path; | ||
35 | |||||
36 | 2 | 4µs | 2 | 27µs | my $auth = $uri->authority; # spent 27µs making 2 calls to URI::_generic::authority, avg 14µs/call |
37 | 2 | 2µs | if (defined($auth)) { | ||
38 | 2 | 3µs | if (lc($auth) ne "localhost" && $auth ne "") { | ||
39 | $auth = uri_unescape($auth); | ||||
40 | unless ($class->_file_is_localhost($auth)) { | ||||
41 | push(@path, "", "", $auth); | ||||
42 | } | ||||
43 | } | ||||
44 | } | ||||
45 | |||||
46 | 2 | 14µs | 2 | 240µs | my @ps = $uri->path_segments; # spent 240µs making 2 calls to URI::_generic::path_segments, avg 120µs/call |
47 | 2 | 1µs | shift @ps if @path; | ||
48 | 2 | 7µs | push(@path, @ps); | ||
49 | |||||
50 | 2 | 1µs | for (@path) { | ||
51 | # Unix file/directory names are not allowed to contain '\0' or '/' | ||||
52 | 20 | 44µs | 20 | 8µs | return undef if /\0/; # spent 8µs making 20 calls to URI::file::Unix::CORE:match, avg 400ns/call |
53 | 20 | 41µs | 20 | 3µs | return undef if /\//; # should we really? # spent 3µs making 20 calls to URI::file::Unix::CORE:match, avg 150ns/call |
54 | } | ||||
55 | |||||
56 | 2 | 21µs | return join("/", @path); | ||
57 | } | ||||
58 | |||||
59 | 1 | 5µs | 1; | ||
sub URI::file::Unix::CORE:match; # opcode |