| 1 | package Perl6::Caller; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.100'; | |||||||||||||||||||
| 7 | 2 | $VERSION = eval $VERSION; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 2 | ▶ | use overload '""' => \&package, fallback => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | ▶ | sub import { | ||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | my ($class) = @_; | |||||||||||||||||||
| 13 | 2 | my $callpack = caller; | |||||||||||||||||||
| 14 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 2 | *{"$callpack\::caller"} = \&caller; | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 92 | ▶ | sub caller { | ||||||||||||||||||
|
Subroutine
caller: called CC=4 SCAR=15.2
Pod
documented
| |||||||||||||||||||||
| 19 | 92 | ▶ | my $thing = shift || 0; | ||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||
| 20 | 92 | ▶ | my $frame = | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
shift() or 0
MC/DC0%0/1
shift() or 0
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||
| 21 | __PACKAGE__ eq $thing | ||||||||||||||||||||
| 22 | ? ( shift || 0 ) | ||||||||||||||||||||
| 23 | : $thing; | ||||||||||||||||||||
| 24 | 92 | return __PACKAGE__->new($frame); | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 2 | my @methods; | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 2 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 30 | 2 | @methods = qw/package filename line subroutine hasargs | |||||||||||||||||||
| 31 | wantarray evaltext is_require/; | ||||||||||||||||||||
| 32 | 2 | foreach my $method (@methods) { | |||||||||||||||||||
| 33 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | 88 | ▶ | *$method = sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 35 | 88 | my ( $self, $frame ) = @_; | |||||||||||||||||||
| 36 | 88 | return $self->{$method}; | |||||||||||||||||||
| 37 | 16 | }; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 94 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||
| 42 | 94 | my $class = shift; | |||||||||||||||||||
| 43 | 94 | ▶ | my $frame = @_ ? (shift || 0) : -1; | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
shift() or 0
MC/DC100%1/1
shift() or 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||
| 44 | 94 | $frame += 2; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 94 | my $self = bless {} => __PACKAGE__; | |||||||||||||||||||
| 47 | 94 | my @caller = CORE::caller($frame); | |||||||||||||||||||
| 48 | 94 | ▶ | return @caller if CORE::wantarray; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 49 | 84 | @$self{@methods} = @caller; | |||||||||||||||||||
| 50 | 84 | return $self; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 2 | 1; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||