| Filename | /usr/share/perl/5.36/Pod/Simple/LinkSection.pm |
| Statements | Executed 11 statements in 316µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 7.40ms | 8.25ms | Pod::Simple::LinkSection::BEGIN@7 |
| 1 | 1 | 1 | 8µs | 10µs | Pod::Simple::LinkSection::BEGIN@6 |
| 1 | 1 | 1 | 6µs | 25µs | Pod::Simple::LinkSection::BEGIN@11 |
| 1 | 1 | 1 | 5µs | 20µs | Pod::Simple::LinkSection::BEGIN@8 |
| 1 | 1 | 1 | 300ns | 300ns | Pod::Simple::LinkSection::__ANON__ (xsub) |
| 0 | 0 | 0 | 0s | 0s | Pod::Simple::LinkSection::as_string |
| 0 | 0 | 0 | 0s | 0s | Pod::Simple::LinkSection::new |
| 0 | 0 | 0 | 0s | 0s | Pod::Simple::LinkSection::stringify |
| 0 | 0 | 0 | 0s | 0s | Pod::Simple::LinkSection::tack_on |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | 1 | 4µs | require 5; | ||
| 3 | package Pod::Simple::LinkSection; | ||||
| 4 | # Based somewhat dimly on Array::Autojoin | ||||
| 5 | |||||
| 6 | 2 | 18µs | 2 | 12µs | # spent 10µs (8+2) within Pod::Simple::LinkSection::BEGIN@6 which was called:
# once (8µs+2µs) by Pod::Simple::BEGIN@9 at line 6 # spent 10µs making 1 call to Pod::Simple::LinkSection::BEGIN@6
# spent 2µs making 1 call to strict::import |
| 7 | 2 | 100µs | 2 | 8.25ms | # spent 8.25ms (7.40+857µs) within Pod::Simple::LinkSection::BEGIN@7 which was called:
# once (7.40ms+857µs) by Pod::Simple::BEGIN@9 at line 7 # spent 8.25ms making 1 call to Pod::Simple::LinkSection::BEGIN@7
# spent 300ns making 1 call to Pod::Simple::LinkSection::__ANON__ |
| 8 | 2 | 33µs | 2 | 35µs | # spent 20µs (5+15) within Pod::Simple::LinkSection::BEGIN@8 which was called:
# once (5µs+15µs) by Pod::Simple::BEGIN@9 at line 8 # spent 20µs making 1 call to Pod::Simple::LinkSection::BEGIN@8
# spent 15µs making 1 call to vars::import |
| 9 | 1 | 200ns | $VERSION = '3.43'; | ||
| 10 | |||||
| 11 | # spent 25µs (6+20) within Pod::Simple::LinkSection::BEGIN@11 which was called:
# once (6µs+20µs) by Pod::Simple::BEGIN@9 at line 17 | ||||
| 12 | 1 | 5µs | 1 | 20µs | '""' => \&Pod::Simple::BlackBox::stringify_lol, # spent 20µs making 1 call to overload::import |
| 13 | 'bool' => \&Pod::Simple::BlackBox::stringify_lol, | ||||
| 14 | # '.=' => \&tack_on, # grudgingly support | ||||
| 15 | |||||
| 16 | 'fallback' => 1, # turn on cleverness | ||||
| 17 | 1 | 153µs | 1 | 25µs | ); # spent 25µs making 1 call to Pod::Simple::LinkSection::BEGIN@11 |
| 18 | |||||
| 19 | sub tack_on { | ||||
| 20 | $_[0] = ['', {}, "$_[0]" ]; | ||||
| 21 | return $_[0][2] .= $_[1]; | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | sub as_string { | ||||
| 25 | goto &Pod::Simple::BlackBox::stringify_lol; | ||||
| 26 | } | ||||
| 27 | sub stringify { | ||||
| 28 | goto &Pod::Simple::BlackBox::stringify_lol; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | sub new { | ||||
| 32 | my $class = shift; | ||||
| 33 | $class = ref($class) || $class; | ||||
| 34 | my $new; | ||||
| 35 | if(@_ == 1) { | ||||
| 36 | if (!ref($_[0] || '')) { # most common case: one bare string | ||||
| 37 | return bless ['', {}, $_[0] ], $class; | ||||
| 38 | } elsif( ref($_[0] || '') eq 'ARRAY') { | ||||
| 39 | $new = [ @{ $_[0] } ]; | ||||
| 40 | } else { | ||||
| 41 | Carp::croak( "$class new() doesn't know to clone $new" ); | ||||
| 42 | } | ||||
| 43 | } else { # misc stuff | ||||
| 44 | $new = [ '', {}, @_ ]; | ||||
| 45 | } | ||||
| 46 | |||||
| 47 | # By now it's a treelet: [ 'foo', {}, ... ] | ||||
| 48 | foreach my $x (@$new) { | ||||
| 49 | if(ref($x || '') eq 'ARRAY') { | ||||
| 50 | $x = $class->new($x); # recurse | ||||
| 51 | } elsif(ref($x || '') eq 'HASH') { | ||||
| 52 | $x = { %$x }; | ||||
| 53 | } | ||||
| 54 | # otherwise leave it. | ||||
| 55 | } | ||||
| 56 | |||||
| 57 | return bless $new, $class; | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | # Not much in this class is likely to be link-section specific -- | ||||
| 61 | # but it just so happens that link-sections are about the only treelets | ||||
| 62 | # that are exposed to the user. | ||||
| 63 | |||||
| 64 | 1 | 2µs | 1; | ||
| 65 | |||||
| 66 | __END__ | ||||
# spent 300ns within Pod::Simple::LinkSection::__ANON__ which was called:
# once (300ns+0s) by Pod::Simple::LinkSection::BEGIN@7 at line 7 |