blib/lib/Acme/DotDotGone.pm

filter: Statementstmt 100% 43 / 43 Branchbran 87.5% 14 / 16 Conditioncond 20.0% 1 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 16 / 16 Podpod n/a totaltotal 90.2% 74 / 82 CC 10 SCAR 15.5
CC
10
Cov
91%
import
10.3
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
↑ Summary
1 package Acme::DotDotGone;
2  
3 4 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.03';
8  
9 4 our %dots;
10 BEGIN {
11 %dots = (
12 toDots => sub {
13 1 ▶ join ' ', map { $dots{$_}() } split '', unpack "b*", shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
14 },
15 fromDots => sub {
16 2 ▶ pack "b*", join '', map { $dots{$_}() } split ' ', shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
17 },
18 426 ▶ '.' => sub { 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
19 342 ▶ '..' => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
20 213 ▶ 0 => sub { '.' },
Subroutine __ANON__: called CC=1 SCAR=0.0
21 171 ▶ 1 => sub { '..' },
Subroutine __ANON__: called CC=1 SCAR=0.0
22 3 ▶ stderr => sub { print @_ }
Subroutine __ANON__: called CC=1 SCAR=0.0
23 4 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 4 close STDERR; # *\o/*
25 }
26  
27 sub import {
28 4 ▶ open FH, "<$0";
Subroutine import: called CC=10 SCAR=23.3
29  
30 4 ▶ my $reg = $_[1]
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 2 2 4
31 ? qr/(.*)\1^\s*use\s+Acme::DotDotGone\s+($_[1]);\n/
32 : qr/.*^\s*use\s+Acme::DotDotGone;\n/;
33  
34 4 ($_[2] = (join '', <FH>)) =~ s/$reg//sm;
35 4 ▶ $_[2] = $1 . $_[2] if $1;
Branch: 1 branch
BranchTrueFalseTotal
if $1 0 4 4
36  
37 4 close FH;
38  
39 ($_[2], $_[3], $_[4]) = (($2)
40 ? ($2 eq 'dot')
41 ? sub {
42 1 ▶ $_[1] = $dots{toDots}($_[0]);
Subroutine __ANON__: called CC=1 SCAR=0.0
43 1 $_[0], $_[1], $_[1];
44 }
45 : sub {
46 1 ▶ $_[1] = $dots{fromDots}($_[0]);
Subroutine __ANON__: called CC=1 SCAR=0.0
47 1 $_[1], $_[0], $_[1];
48 }
49 : ($_[2] =~ m/[a-zA-Z]/)
50 ? sub {
51 undef
52 1 ▶ }
Subroutine __ANON__: called CC=1 SCAR=0.0
53 : sub {
54 1 ▶ $_[1] = $dots{fromDots}($_[0]);
Subroutine __ANON__: called CC=1 SCAR=0.0
55 1 $_[1], $_[0];
56 }
57 4 ▶ )->($_[2]);
Branch: 3 branches
BranchTrueFalseTotal
$2 ? : 2 2 4
$2 eq 'dot' ? : 1 1 2
$_[2] =~ /[a-zA-Z]/ ? : 1 1 2
58  
59 4 ▶ if ($_[4]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[4]) 2 2 4
60 2 ▶ open FH, ">$0" or print "Cannot encode. '$0'\n" and exit;
Branch: 1 branch
BranchTrueFalseTotal
open FH, ">$0" or print "Cannot encode. '$0'\n" and exit 0 2 2
Condition20%1/5
open(FH, ">$0") || print("Cannot encode. '$0'\n") && exit
l!l&&r!l&&!r
200
print "Cannot encode. '$0'\n" and exit
!ll
00
MC/DC0%0/2
open(FH, ">$0") || print("Cannot encode. '$0'\n") && exit
open(FH, ">$0") print "Cannot encode. '$0'\n"
Truth table33%1/3
A || B
A= open(FH, ">$0")B= print "Cannot encode. '$0'\n"
ABresult
1X1
011
000
61 2 print FH "use Acme::DotDotGone;\n";
62 2 print FH $_[4];
63 2 close FH;
64 }
65  
66 4 ▶ do { eval "$_[2]"; $dots{stderr}($@); } if $_[2];
Branch: 1 branch
BranchTrueFalseTotal
if ($_[2]) 3 1 4
67 }
68  
69 4 1;
70  
71 __END__
↑ Summary