blib/lib/Alias/Any.pm

filter: Statementstmt 68.1% 47 / 69 Branchbran 40.0% 4 / 10 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 78.5% 11 / 14 Podpod n/a totaltotal 64.6% 64 / 99 CC 8 SCAR 12.0
CC
8
Cov
64%
unimport
6.5
import
5.7
_delete_source
2.0
CRAP 3.3
↑ Summary
1 package Alias::Any;
2  
3 6 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 our $VERSION = '0.000007';
7  
8 6 ▶use Keyword::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Make 'keyword' and 'unkeyword' no-ops, unless Keyword::Declare is later loaded...
11 6 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=1.2
12 0 ▶ sub _delete_source { my $ref = shift; $$ref =~ s{ \A .*? [#]END_OF_ALIAS }{}xms; }
Subroutine _delete_source: not called CC=1 SCAR=6.9
13 6 Keyword::Simple::define( keyword => \&_delete_source );
14 6 Keyword::Simple::define( unkeyword => \&_delete_source );
15 }
16  
17 7 ▶sub import {
Subroutine import: called CC=4 SCAR=17.4
18 # Below 5.22, alias keyword just injects Data::Alias...
19 7 ▶ if ($^V < 5.022) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^V < "5.022") 0 7 7
20 Keyword::Simple::define(
21 0 ▶ alias => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 my $ref = shift;
23 0 $$ref = q{use Data::Alias; Data::Alias::alias} . $$ref;
24 }
25 0 );
26 }
27  
28 # Above 5.22, alias keyword replaced with built-in syntax...
29 6 ▶ use if $^V >= 5.022, 'Keyword::Declare';
Subroutine BEGIN: called CC=1 SCAR=0.0
30 7  
31 0 ▶ keyword alias (Variable|VariableDeclaration $variable, '=', Expr $expr) {{{
Subroutine __ANON__: called CC=1 SCAR=1.3
Subroutine __ANON__: not called CC=1 SCAR=1.3
Branch: 1 branch
BranchTrueFalseTotal
if (((caller 0)[3] // "") =~ /\b(?:un)?import\Z/u) 7 0 7
Condition50%1/2
(caller 0)[3] // ""
l!l
70
MC/DC0%0/1
(caller 0)[3] // ""
(caller 0)[3]
Truth table50%1/2
A
A= (caller 0)[3]
Aresult
11
00
32 0 use feature 'refaliasing';
33 0 no warnings 'experimental::refaliasing';
34 \<{$variable}> = \<{$expr}>
35 0 }}} #END_OF_ALIAS
36 0 }
37 0  
38 2 ▶sub unimport {
Subroutine unimport: called CC=5 SCAR=18.6
39 0 # Below 5.22, alias keyword is undefined by Keyword::Simple...
40 2 ▶ if ($^V < 5.022) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^V < "5.022") 0 2 2
41 0 Keyword::Simple::undefine('alias');
42 0 ▶ if ($Keyword::Simple::VERSION < 0.04) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Keyword::Simple::VERSION < "0.04") 0 0 0
43 0 $^H{'Keyword::Simple/keywords'} =~ s{ alias:(?:\d+|-\d*)}{}g;
44 7 ▶ }
Subroutine BEGIN: called CC=1 SCAR=0.0
45 6 }
46  
47 # Above 5.22, alias keyword is unkeyworded by Keyword::Declare...
48 6 ▶ use if $^V >= 5.022, 'Keyword::Declare';
Subroutine BEGIN: called CC=1 SCAR=0.0
49 2 ▶ unkeyword alias; #END_OF_ALIAS
Branch: 1 branch
BranchTrueFalseTotal
if (((caller 0)[3] // "") =~ /\b(?:un)?import\Z/u) 2 0 2
Condition50%1/2
(caller 0)[3] // ""
l!l
20
MC/DC0%0/1
(caller 0)[3] // ""
(caller 0)[3]
Truth table50%1/2
A
A= (caller 0)[3]
Aresult
11
00
50 2 }
51 6 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
52 6  
53 6 1; # Magic true value required at end of module
54 __END__
↑ Summary