| Filename | /usr/share/perl5/Context/Preserve.pm |
| Statements | Executed 0 statements in 0s |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 50µs | 777µs | Context::Preserve::preserve_context |
| 1 | 1 | 1 | 14µs | 20µs | Context::Preserve::BEGIN@2 |
| 1 | 1 | 1 | 10µs | 47µs | Context::Preserve::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 40µs | Context::Preserve::BEGIN@6 |
| 1 | 1 | 1 | 8µs | 11µs | Context::Preserve::BEGIN@3 |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Context::Preserve; | ||||
| 2 | 2 | 27µs | # spent 20µs (14+6) within Context::Preserve::BEGIN@2 which was called:
# once (14µs+6µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 2 # spent 20µs making 1 call to Context::Preserve::BEGIN@2
# spent 6µs making 1 call to strict::import | ||
| 3 | 2 | 15µs | # spent 11µs (8+4) within Context::Preserve::BEGIN@3 which was called:
# once (8µs+4µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 3 # spent 11µs making 1 call to Context::Preserve::BEGIN@3
# spent 4µs making 1 call to warnings::import | ||
| 4 | 2 | 83µs | # spent 47µs (10+36) within Context::Preserve::BEGIN@4 which was called:
# once (10µs+36µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 4 # spent 47µs making 1 call to Context::Preserve::BEGIN@4
# spent 36µs making 1 call to Exporter::import | ||
| 5 | |||||
| 6 | 2 | 40µs | # spent 40µs (8+32) within Context::Preserve::BEGIN@6 which was called:
# once (8µs+32µs) by DBIx::Class::Storage::BlockRunner::BEGIN@9 at line 6 # spent 40µs making 1 call to Context::Preserve::BEGIN@6
# spent 32µs making 1 call to base::import, recursion: max depth 2, sum of overlapping time 32µs | ||
| 7 | our @EXPORT = qw(preserve_context); | ||||
| 8 | |||||
| 9 | our $VERSION = '0.01'; | ||||
| 10 | |||||
| 11 | # spent 777µs (50+727) within Context::Preserve::preserve_context which was called:
# once (50µs+727µs) by DBIx::Class::Storage::BlockRunner::_run at line 233 of DBIx/Class/Storage/BlockRunner.pm | ||||
| 12 | my $orig = shift; | ||||
| 13 | my %args = @_; | ||||
| 14 | |||||
| 15 | my $replace = $args{replace}; | ||||
| 16 | my $after = $args{after}; | ||||
| 17 | |||||
| 18 | croak 'need an "after" or "replace" coderef' | ||||
| 19 | unless $replace || $after; | ||||
| 20 | |||||
| 21 | if(!defined wantarray){ | ||||
| 22 | 1 | 690µs | $orig->(); # spent 690µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:155] | ||
| 23 | if($after){ | ||||
| 24 | $after->(); | ||||
| 25 | } | ||||
| 26 | else { | ||||
| 27 | 1 | 37µs | $replace->(); # spent 37µs making 1 call to DBIx::Class::Storage::BlockRunner::__ANON__[DBIx/Class/Storage/BlockRunner.pm:233] | ||
| 28 | } | ||||
| 29 | return; | ||||
| 30 | } | ||||
| 31 | elsif(wantarray){ | ||||
| 32 | my @result = $orig->(); | ||||
| 33 | if($after){ | ||||
| 34 | my @ignored = $after->(@result); | ||||
| 35 | } | ||||
| 36 | else { | ||||
| 37 | @result = $replace->(@result); | ||||
| 38 | } | ||||
| 39 | return @result; | ||||
| 40 | } | ||||
| 41 | else { | ||||
| 42 | my $result = $orig->(); | ||||
| 43 | if($after){ | ||||
| 44 | my $ignored = $after->($result); | ||||
| 45 | } | ||||
| 46 | else { | ||||
| 47 | $result = $replace->($result); | ||||
| 48 | } | ||||
| 49 | return $result; | ||||
| 50 | } | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | 1; | ||||
| 54 | __END__ |