| Filename | /usr/local/perls/perl-5.26.1/lib/site_perl/5.26.1/URI/URL.pm |
| Statements | Executed 23 statements in 3.16ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 1.05ms | 12.5ms | URI::URL::BEGIN@6 |
| 2 | 1 | 1 | 104µs | 9.53ms | URI::URL::new |
| 1 | 1 | 1 | 50µs | 57µs | URI::URL::BEGIN@3 |
| 1 | 1 | 1 | 36µs | 78µs | URI::URL::BEGIN@4 |
| 1 | 1 | 1 | 22µs | 46µs | URI::URL::BEGIN@13 |
| 1 | 1 | 1 | 16µs | 76µs | URI::URL::BEGIN@19 |
| 0 | 0 | 0 | 0s | 0s | URI::URL::_try |
| 0 | 0 | 0 | 0s | 0s | URI::URL::abs |
| 0 | 0 | 0 | 0s | 0s | URI::URL::address |
| 0 | 0 | 0 | 0s | 0s | URI::URL::article |
| 0 | 0 | 0 | 0s | 0s | URI::URL::crack |
| 0 | 0 | 0 | 0s | 0s | URI::URL::dos_path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::encoded822addr |
| 0 | 0 | 0 | 0s | 0s | URI::URL::eparams |
| 0 | 0 | 0 | 0s | 0s | URI::URL::epath |
| 0 | 0 | 0 | 0s | 0s | URI::URL::frag |
| 0 | 0 | 0 | 0s | 0s | URI::URL::full_path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::groupart |
| 0 | 0 | 0 | 0s | 0s | URI::URL::keywords |
| 0 | 0 | 0 | 0s | 0s | URI::URL::local_path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::mac_path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::netloc |
| 0 | 0 | 0 | 0s | 0s | URI::URL::newlocal |
| 0 | 0 | 0 | 0s | 0s | URI::URL::params |
| 0 | 0 | 0 | 0s | 0s | URI::URL::path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::path_components |
| 0 | 0 | 0 | 0s | 0s | URI::URL::print_on |
| 0 | 0 | 0 | 0s | 0s | URI::URL::query |
| 0 | 0 | 0 | 0s | 0s | URI::URL::strict |
| 0 | 0 | 0 | 0s | 0s | URI::URL::unix_path |
| 0 | 0 | 0 | 0s | 0s | URI::URL::url |
| 0 | 0 | 0 | 0s | 0s | URI::URL::vms_path |
| 0 | 0 | 0 | 0s | 0s | URI::_foreign::_init |
| 0 | 0 | 0 | 0s | 0s | URI::mailto::authority |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package URI::URL; | ||||
| 2 | |||||
| 3 | 2 | 76µs | 2 | 64µs | # spent 57µs (50+7) within URI::URL::BEGIN@3 which was called:
# once (50µs+7µs) by CPAN::has_inst at line 3 # spent 57µs making 1 call to URI::URL::BEGIN@3
# spent 7µs making 1 call to strict::import |
| 4 | 2 | 923µs | 2 | 120µs | # spent 78µs (36+42) within URI::URL::BEGIN@4 which was called:
# once (36µs+42µs) by CPAN::has_inst at line 4 # spent 78µs making 1 call to URI::URL::BEGIN@4
# spent 42µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 2 | 626µs | 2 | 23.3ms | # spent 12.5ms (1.05+11.5) within URI::URL::BEGIN@6 which was called:
# once (1.05ms+11.5ms) by CPAN::has_inst at line 6 # spent 12.5ms making 1 call to URI::URL::BEGIN@6
# spent 10.8ms making 1 call to parent::import |
| 7 | |||||
| 8 | 1 | 1µs | our $VERSION = "5.04"; | ||
| 9 | |||||
| 10 | # Provide as much as possible of the old URI::URL interface for backwards | ||||
| 11 | # compatibility... | ||||
| 12 | |||||
| 13 | 3 | 115µs | 3 | 70µs | # spent 46µs (22+24) within URI::URL::BEGIN@13 which was called:
# once (22µs+24µs) by CPAN::has_inst at line 13 # spent 46µs making 1 call to URI::URL::BEGIN@13
# spent 15µs making 1 call to version::_VERSION
# spent 9µs making 1 call to Exporter::import |
| 14 | 1 | 1µs | our @EXPORT = qw(url); | ||
| 15 | |||||
| 16 | # Easy to use constructor | ||||
| 17 | sub url ($;$) { URI::URL->new(@_); } | ||||
| 18 | |||||
| 19 | 2 | 1.32ms | 2 | 136µs | # spent 76µs (16+60) within URI::URL::BEGIN@19 which was called:
# once (16µs+60µs) by CPAN::has_inst at line 19 # spent 76µs making 1 call to URI::URL::BEGIN@19
# spent 60µs making 1 call to Exporter::import |
| 20 | |||||
| 21 | sub new | ||||
| 22 | # spent 9.53ms (104µs+9.42) within URI::URL::new which was called 2 times, avg 4.76ms/call:
# 2 times (104µs+9.42ms) by CPAN::FTP::hostdleasy at line 563 of CPAN/FTP.pm, avg 4.76ms/call | ||||
| 23 | 2 | 1µs | my $class = shift; | ||
| 24 | 2 | 11µs | 2 | 8.90ms | my $self = $class->SUPER::new(@_); # spent 8.90ms making 2 calls to URI::WithBase::new, avg 4.45ms/call |
| 25 | 2 | 71µs | 2 | 527µs | $self->[0] = $self->[0]->canonical; # spent 527µs making 2 calls to URI::file::canonical, avg 264µs/call |
| 26 | 2 | 10µs | $self; | ||
| 27 | } | ||||
| 28 | |||||
| 29 | sub newlocal | ||||
| 30 | { | ||||
| 31 | my $class = shift; | ||||
| 32 | require URI::file; | ||||
| 33 | bless [URI::file->new_abs(shift)], $class; | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | {package URI::_foreign; | ||||
| 37 | sub _init # hope it is not defined | ||||
| 38 | { | ||||
| 39 | my $class = shift; | ||||
| 40 | die "Unknown URI::URL scheme $_[1]:" if $URI::URL::STRICT; | ||||
| 41 | $class->SUPER::_init(@_); | ||||
| 42 | } | ||||
| 43 | } | ||||
| 44 | |||||
| 45 | sub strict | ||||
| 46 | 1 | 1µs | { | ||
| 47 | my $old = $URI::URL::STRICT; | ||||
| 48 | $URI::URL::STRICT = shift if @_; | ||||
| 49 | $old; | ||||
| 50 | } | ||||
| 51 | |||||
| 52 | sub print_on | ||||
| 53 | { | ||||
| 54 | my $self = shift; | ||||
| 55 | require Data::Dumper; | ||||
| 56 | print STDERR Data::Dumper::Dumper($self); | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | sub _try | ||||
| 60 | { | ||||
| 61 | my $self = shift; | ||||
| 62 | my $method = shift; | ||||
| 63 | scalar(eval { $self->$method(@_) }); | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | sub crack | ||||
| 67 | { | ||||
| 68 | # should be overridden by subclasses | ||||
| 69 | my $self = shift; | ||||
| 70 | (scalar($self->scheme), | ||||
| 71 | $self->_try("user"), | ||||
| 72 | $self->_try("password"), | ||||
| 73 | $self->_try("host"), | ||||
| 74 | $self->_try("port"), | ||||
| 75 | $self->_try("path"), | ||||
| 76 | $self->_try("params"), | ||||
| 77 | $self->_try("query"), | ||||
| 78 | scalar($self->fragment), | ||||
| 79 | ) | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | sub full_path | ||||
| 83 | { | ||||
| 84 | my $self = shift; | ||||
| 85 | my $path = $self->path_query; | ||||
| 86 | $path = "/" unless length $path; | ||||
| 87 | $path; | ||||
| 88 | } | ||||
| 89 | |||||
| 90 | sub netloc | ||||
| 91 | { | ||||
| 92 | shift->authority(@_); | ||||
| 93 | } | ||||
| 94 | |||||
| 95 | sub epath | ||||
| 96 | { | ||||
| 97 | my $path = shift->SUPER::path(@_); | ||||
| 98 | $path =~ s/;.*//; | ||||
| 99 | $path; | ||||
| 100 | } | ||||
| 101 | |||||
| 102 | sub eparams | ||||
| 103 | { | ||||
| 104 | my $self = shift; | ||||
| 105 | my @p = $self->path_segments; | ||||
| 106 | return undef unless ref($p[-1]); | ||||
| 107 | @p = @{$p[-1]}; | ||||
| 108 | shift @p; | ||||
| 109 | join(";", @p); | ||||
| 110 | } | ||||
| 111 | |||||
| 112 | sub params { shift->eparams(@_); } | ||||
| 113 | |||||
| 114 | sub path { | ||||
| 115 | my $self = shift; | ||||
| 116 | my $old = $self->epath(@_); | ||||
| 117 | return unless defined wantarray; | ||||
| 118 | return '/' if !defined($old) || !length($old); | ||||
| 119 | Carp::croak("Path components contain '/' (you must call epath)") | ||||
| 120 | if $old =~ /%2[fF]/ and !@_; | ||||
| 121 | $old = "/$old" if $old !~ m|^/| && defined $self->netloc; | ||||
| 122 | return uri_unescape($old); | ||||
| 123 | } | ||||
| 124 | |||||
| 125 | sub path_components { | ||||
| 126 | shift->path_segments(@_); | ||||
| 127 | } | ||||
| 128 | |||||
| 129 | sub query { | ||||
| 130 | my $self = shift; | ||||
| 131 | my $old = $self->equery(@_); | ||||
| 132 | if (defined(wantarray) && defined($old)) { | ||||
| 133 | if ($old =~ /%(?:26|2[bB]|3[dD])/) { # contains escaped '=' '&' or '+' | ||||
| 134 | my $mess; | ||||
| 135 | for ($old) { | ||||
| 136 | $mess = "Query contains both '+' and '%2B'" | ||||
| 137 | if /\+/ && /%2[bB]/; | ||||
| 138 | $mess = "Form query contains escaped '=' or '&'" | ||||
| 139 | if /=/ && /%(?:3[dD]|26)/; | ||||
| 140 | } | ||||
| 141 | if ($mess) { | ||||
| 142 | Carp::croak("$mess (you must call equery)"); | ||||
| 143 | } | ||||
| 144 | } | ||||
| 145 | # Now it should be safe to unescape the string without losing | ||||
| 146 | # information | ||||
| 147 | return uri_unescape($old); | ||||
| 148 | } | ||||
| 149 | undef; | ||||
| 150 | |||||
| 151 | } | ||||
| 152 | |||||
| 153 | sub abs | ||||
| 154 | { | ||||
| 155 | my $self = shift; | ||||
| 156 | my $base = shift; | ||||
| 157 | my $allow_scheme = shift; | ||||
| 158 | $allow_scheme = $URI::URL::ABS_ALLOW_RELATIVE_SCHEME | ||||
| 159 | unless defined $allow_scheme; | ||||
| 160 | local $URI::ABS_ALLOW_RELATIVE_SCHEME = $allow_scheme; | ||||
| 161 | local $URI::ABS_REMOTE_LEADING_DOTS = $URI::URL::ABS_REMOTE_LEADING_DOTS; | ||||
| 162 | $self->SUPER::abs($base); | ||||
| 163 | } | ||||
| 164 | |||||
| 165 | sub frag { shift->fragment(@_); } | ||||
| 166 | sub keywords { shift->query_keywords(@_); } | ||||
| 167 | |||||
| 168 | # file: | ||||
| 169 | sub local_path { shift->file; } | ||||
| 170 | sub unix_path { shift->file("unix"); } | ||||
| 171 | sub dos_path { shift->file("dos"); } | ||||
| 172 | sub mac_path { shift->file("mac"); } | ||||
| 173 | sub vms_path { shift->file("vms"); } | ||||
| 174 | |||||
| 175 | # mailto: | ||||
| 176 | sub address { shift->to(@_); } | ||||
| 177 | sub encoded822addr { shift->to(@_); } | ||||
| 178 | sub URI::mailto::authority { shift->to(@_); } # make 'netloc' method work | ||||
| 179 | |||||
| 180 | # news: | ||||
| 181 | sub groupart { shift->_group(@_); } | ||||
| 182 | sub article { shift->message(@_); } | ||||
| 183 | |||||
| 184 | 1 | 6µs | 1; | ||
| 185 | |||||
| 186 | __END__ |