Filename | /usr/local/perls/perl-5.26.1/lib/site_perl/5.26.1/URI/file/Base.pm |
Statements | Executed 9 statements in 890µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 33µs | 37µs | BEGIN@3 | URI::file::Base::
1 | 1 | 1 | 18µs | 31µs | BEGIN@4 | URI::file::Base::
1 | 1 | 1 | 7µs | 7µs | BEGIN@6 | URI::file::Base::
0 | 0 | 0 | 0s | 0s | _file_extract_authority | URI::file::Base::
0 | 0 | 0 | 0s | 0s | _file_extract_path | URI::file::Base::
0 | 0 | 0 | 0s | 0s | _file_is_absolute | URI::file::Base::
0 | 0 | 0 | 0s | 0s | _file_is_localhost | URI::file::Base::
0 | 0 | 0 | 0s | 0s | dir | URI::file::Base::
0 | 0 | 0 | 0s | 0s | file | URI::file::Base::
0 | 0 | 0 | 0s | 0s | new | URI::file::Base::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package URI::file::Base; | ||||
2 | |||||
3 | 2 | 50µs | 2 | 41µs | # spent 37µs (33+4) within URI::file::Base::BEGIN@3 which was called:
# once (33µs+4µs) by parent::import at line 3 # spent 37µs making 1 call to URI::file::Base::BEGIN@3
# spent 4µs making 1 call to strict::import |
4 | 2 | 39µs | 2 | 44µs | # spent 31µs (18+13) within URI::file::Base::BEGIN@4 which was called:
# once (18µs+13µs) by parent::import at line 4 # spent 31µs making 1 call to URI::file::Base::BEGIN@4
# spent 13µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 771µs | 1 | 7µs | # spent 7µs within URI::file::Base::BEGIN@6 which was called:
# once (7µs+0s) by parent::import at line 6 # spent 7µs making 1 call to URI::file::Base::BEGIN@6 |
7 | |||||
8 | 1 | 0s | our $VERSION = '1.72'; | ||
9 | 1 | 26µs | $VERSION = eval $VERSION; # spent 6µs executing statements in string eval | ||
10 | |||||
11 | sub new | ||||
12 | { | ||||
13 | my $class = shift; | ||||
14 | my $path = shift; | ||||
15 | $path = "" unless defined $path; | ||||
16 | |||||
17 | my($auth, $escaped_auth, $escaped_path); | ||||
18 | |||||
19 | ($auth, $escaped_auth) = $class->_file_extract_authority($path); | ||||
20 | ($path, $escaped_path) = $class->_file_extract_path($path); | ||||
21 | |||||
22 | if (defined $auth) { | ||||
23 | $auth =~ s,%,%25,g unless $escaped_auth; | ||||
24 | $auth =~ s,([/?\#]), URI::Escape::escape_char($1),eg; | ||||
25 | $auth = "//$auth"; | ||||
26 | if (defined $path) { | ||||
27 | $path = "/$path" unless substr($path, 0, 1) eq "/"; | ||||
28 | } else { | ||||
29 | $path = ""; | ||||
30 | } | ||||
31 | } else { | ||||
32 | return undef unless defined $path; | ||||
33 | $auth = ""; | ||||
34 | } | ||||
35 | |||||
36 | $path =~ s,([%;?]), URI::Escape::escape_char($1),eg unless $escaped_path; | ||||
37 | $path =~ s/\#/%23/g; | ||||
38 | |||||
39 | my $uri = $auth . $path; | ||||
40 | $uri = "file:$uri" if substr($uri, 0, 1) eq "/"; | ||||
41 | |||||
42 | URI->new($uri, "file"); | ||||
43 | } | ||||
44 | |||||
45 | sub _file_extract_authority | ||||
46 | { | ||||
47 | my($class, $path) = @_; | ||||
48 | return undef unless $class->_file_is_absolute($path); | ||||
49 | return $URI::file::DEFAULT_AUTHORITY; | ||||
50 | } | ||||
51 | |||||
52 | sub _file_extract_path | ||||
53 | { | ||||
54 | return undef; | ||||
55 | } | ||||
56 | |||||
57 | sub _file_is_absolute | ||||
58 | { | ||||
59 | return 0; | ||||
60 | } | ||||
61 | |||||
62 | sub _file_is_localhost | ||||
63 | { | ||||
64 | shift; # class | ||||
65 | my $host = lc(shift); | ||||
66 | return 1 if $host eq "localhost"; | ||||
67 | eval { | ||||
68 | require Net::Domain; | ||||
69 | lc(Net::Domain::hostfqdn()) eq $host || | ||||
70 | lc(Net::Domain::hostname()) eq $host; | ||||
71 | }; | ||||
72 | } | ||||
73 | |||||
74 | sub file | ||||
75 | { | ||||
76 | undef; | ||||
77 | } | ||||
78 | |||||
79 | sub dir | ||||
80 | { | ||||
81 | my $self = shift; | ||||
82 | $self->file(@_); | ||||
83 | } | ||||
84 | |||||
85 | 1 | 4µs | 1; |