blib/lib/Exporter/Shiny.pm

filter: Statementstmt 100% 32 / 32 Branchbran 75.0% 6 / 8 Conditioncond 80.0% 4 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 92.5% 50 / 54 CC 8 SCAR 16.2
CC
8
Cov
93%
import
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« blib/lib/Exporter/Tiny.pm ↑ Summary examples/Example/Exporter.pm »
1 package Exporter::Shiny;
2  
3 13 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 13 ▶use Exporter::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 13 our $AUTHORITY = 'cpan:TOBYINK';
10 13 our $VERSION = '1.005_000';
11  
12 sub import {
13 15 ▶ my $me = shift;
Subroutine import: called CC=8 SCAR=20.9
14 15 my $caller = caller;
15
16 15 (my $nominal_file = $caller) =~ s(::)(/)g;
17 15 ▶ $INC{"$nominal_file\.pm"} ||= __FILE__;
Condition50%1/2
$INC{"$nominal_file.pm"} ||= __FILE__
l!l
015
MC/DC0%0/1
$INC{"$nominal_file.pm"} ||= __FILE__
$INC{"$nominal_file.pm"}
Truth table50%1/2
A
A= $INC{"$nominal_file.pm"}
Aresult
11
00
18
19 15 ▶ if (@_ == 2 and $_[0] eq -setup)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2 and $_[0] eq "-setup") 2 13 15
Condition100%3/3
@_ == 2 and $_[0] eq "-setup"
!ll&&!rl&&r
762
MC/DC100%2/2
@_ == 2 and $_[0] eq "-setup"
@_ == 2 $_[0] eq "-setup"
Truth table100%3/3
A and B
A= @_ == 2B= $_[0] eq "-setup"
ABresult
0X0
100
111
20 {
21 2 my (undef, $opts) = @_;
22 2 ▶ @_ = @{ delete($opts->{exports}) || [] };
Branch: 1 branch
BranchTrueFalseTotal
delete $opts->{"exports"} or [] 0 2 2
23
24 2 ▶ if (%$opts) {
Branch: 1 branch
BranchTrueFalseTotal
if (%$opts) 1 1 2
25 1 Exporter::Tiny::_croak(
26 'Unsupported Sub::Exporter-style options: %s',
27 join(q[, ], sort keys %$opts),
28 );
29 }
30 }
31
32 14 ▶ ref($_) && Exporter::Tiny::_croak('Expected sub name, got ref %s', $_) for @_;
Branch: 1 branch
BranchTrueFalseTotal
ref $_ and &Exporter::Tiny::_croak("Expected sub name, got ref %s", $_) 0 29 29
33
34 13 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
35 14 push @{"$caller\::ISA"}, 'Exporter::Tiny';
36 14 push @{"$caller\::EXPORT_OK"}, @_;
37 }
38  
39 13 1;
40  
41 __END__
« blib/lib/Exporter/Tiny.pm ↑ Summary examples/Example/Exporter.pm »