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