blib/lib/Perl6/Caller.pm

filter: Statementstmt 100% 39 / 39 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 10 / 10 Podpod 50.0% 1 / 2 totaltotal 92.4% 61 / 66 CC 8 SCAR 9.8
CC
8
Cov
94%
caller
4.6
new
4.0
BEGIN
2.0
CRAP 2.7
↑ Summary
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
l!l
5438
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
20 92 ▶ my $frame =
Branch: 1 branch
BranchTrueFalseTotal
__PACKAGE__ eq $thing ? : 0 92 92
Condition0%0/2
shift() or 0
l!l
00
MC/DC0%0/1
shift() or 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
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
BranchTrueFalseTotal
@_ ? : 92 2 94
Condition100%2/2
shift() or 0
l!l
5438
MC/DC100%1/1
shift() or 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
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
BranchTrueFalseTotal
if CORE::wantarray 10 84 94
49 84 @$self{@methods} = @caller;
50 84 return $self;
51 }
52  
53 2 1;
54  
55 __END__
↑ Summary