← 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/WithBase.pm
StatementsExecuted 34 statements in 1.49ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1116.15ms9.17msURI::WithBase::::BEGIN@6URI::WithBase::BEGIN@6
41134µs3.82msURI::WithBase::::AUTOLOADURI::WithBase::AUTOLOAD
11131µs35µsURI::WithBase::::BEGIN@3URI::WithBase::BEGIN@3
11124µs108µsURI::WithBase::::BEGIN@7URI::WithBase::BEGIN@7
21122µs8.90msURI::WithBase::::newURI::WithBase::new
11118µs31µsURI::WithBase::::BEGIN@4URI::WithBase::BEGIN@4
11114µs55µsURI::WithBase::::BEGIN@11URI::WithBase::BEGIN@11
0000s0sURI::WithBase::::_initURI::WithBase::_init
0000s0sURI::WithBase::::absURI::WithBase::abs
0000s0sURI::WithBase::::baseURI::WithBase::base
0000s0sURI::WithBase::::canURI::WithBase::can
0000s0sURI::WithBase::::cloneURI::WithBase::clone
0000s0sURI::WithBase::::eqURI::WithBase::eq
0000s0sURI::WithBase::::new_absURI::WithBase::new_abs
0000s0sURI::WithBase::::relURI::WithBase::rel
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package URI::WithBase;
2
3242µs239µs
# spent 35µs (31+4) within URI::WithBase::BEGIN@3 which was called: # once (31µs+4µs) by parent::import at line 3
use strict;
# spent 35µs making 1 call to URI::WithBase::BEGIN@3 # spent 4µs making 1 call to strict::import
4242µs244µs
# spent 31µs (18+13) within URI::WithBase::BEGIN@4 which was called: # once (18µs+13µs) by parent::import at line 4
use warnings;
# spent 31µs making 1 call to URI::WithBase::BEGIN@4 # spent 13µs making 1 call to warnings::import
5
62578µs19.17ms
# spent 9.17ms (6.15+3.02) within URI::WithBase::BEGIN@6 which was called: # once (6.15ms+3.02ms) by parent::import at line 6
use URI;
# spent 9.17ms making 1 call to URI::WithBase::BEGIN@6
7264µs2192µs
# spent 108µs (24+84) within URI::WithBase::BEGIN@7 which was called: # once (24µs+84µs) by parent::import at line 7
use Scalar::Util 'blessed';
# spent 108µs making 1 call to URI::WithBase::BEGIN@7 # spent 84µs making 1 call to Exporter::import
8
911µsour $VERSION = "2.20";
10
112696µs296µs
# spent 55µs (14+41) within URI::WithBase::BEGIN@11 which was called: # once (14µs+41µs) by parent::import at line 11
use overload '""' => "as_string", fallback => 1;
# spent 55µs making 1 call to URI::WithBase::BEGIN@11 # spent 41µs making 1 call to overload::import
12
13sub as_string; # help overload find it
14
15sub new
16
# spent 8.90ms (22µs+8.88) within URI::WithBase::new which was called 2 times, avg 4.45ms/call: # 2 times (22µs+8.88ms) by URI::URL::new at line 24 of URI/URL.pm, avg 4.45ms/call
{
1723µs my($class, $uri, $base) = @_;
1820s my $ibase = $base;
1922µs if ($base && blessed($base) && $base->isa(__PACKAGE__)) {
20 $base = $base->abs;
21 $ibase = $base->[0];
22 }
23223µs28.88ms bless [URI->new($uri, $ibase), $base], $class;
# spent 8.88ms making 2 calls to URI::new, avg 4.44ms/call
24}
25
26sub new_abs
27{
28 my $class = shift;
29 my $self = $class->new(@_);
30 $self->abs;
31}
32
33sub _init
34{
35 my $class = shift;
36 my($str, $scheme) = @_;
37 bless [URI->new($str, $scheme), undef], $class;
38}
39
40sub eq
41{
42 my($self, $other) = @_;
43 $other = $other->[0] if blessed($other) and $other->isa(__PACKAGE__);
44 $self->[0]->eq($other);
45}
46
47our $AUTOLOAD;
48sub AUTOLOAD
49
# spent 3.82ms (34µs+3.78) within URI::WithBase::AUTOLOAD which was called 4 times, avg 955µs/call: # 4 times (34µs+3.78ms) by CPAN::FTP::hostdleasy at line 564 of CPAN/FTP.pm, avg 955µs/call
{
5042µs my $self = shift;
51410µs my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2);
5246µs return if $method eq "DESTROY";
53215µs23.79ms $self->[0]->$method(@_);
# spent 3.79ms making 2 calls to URI::file::file, avg 1.89ms/call
54}
55
56sub can { # override UNIVERSAL::can
57 my $self = shift;
58 $self->SUPER::can(@_) || (
59 ref($self)
60 ? $self->[0]->can(@_)
61 : undef
62 )
63}
64
65sub base {
66 my $self = shift;
67 my $base = $self->[1];
68
69 if (@_) { # set
70 my $new_base = shift;
71 # ensure absoluteness
72 $new_base = $new_base->abs if ref($new_base) && $new_base->isa(__PACKAGE__);
73 $self->[1] = $new_base;
74 }
75 return unless defined wantarray;
76
77 # The base attribute supports 'lazy' conversion from URL strings
78 # to URL objects. Strings may be stored but when a string is
79 # fetched it will automatically be converted to a URL object.
80 # The main benefit is to make it much cheaper to say:
81 # URI::WithBase->new($random_url_string, 'http:')
82 if (defined($base) && !ref($base)) {
83 $base = ref($self)->new($base);
84 $self->[1] = $base unless @_;
85 }
86 $base;
87}
88
89sub clone
90{
91 my $self = shift;
92 my $base = $self->[1];
93 $base = $base->clone if ref($base);
94 bless [$self->[0]->clone, $base], ref($self);
95}
96
97sub abs
98{
99 my $self = shift;
100 my $base = shift || $self->base || return $self->clone;
101 $base = $base->as_string if ref($base);
102 bless [$self->[0]->abs($base, @_), $base], ref($self);
103}
104
105sub rel
106{
107 my $self = shift;
108 my $base = shift || $self->base || return $self->clone;
109 $base = $base->as_string if ref($base);
110 bless [$self->[0]->rel($base, @_), $base], ref($self);
111}
112
11314µs1;
114
115__END__