| 1 | package Acme::DotDotGone; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 1 | our %dots; | |||||||||||||||||||||||||||||||
| 10 | BEGIN { | ||||||||||||||||||||||||||||||||
| 11 | %dots = ( | ||||||||||||||||||||||||||||||||
| 12 | toDots => sub { | ||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | join ' ', map { $dots{$_}() } split '', unpack "b*", shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 14 | }, | ||||||||||||||||||||||||||||||||
| 15 | fromDots => sub { | ||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | pack "b*", join '', map { $dots{$_}() } split ' ', shift; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 17 | }, | ||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | '.' => sub { 0 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | '..' => sub { 1 }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | 0 => sub { '.' }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | 1 => sub { '..' }, | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | stderr => sub { print @_ } | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 24 | 1 | close STDERR; # *\o/* | |||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | sub import { | ||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | open FH, "<$0" or print "Cannot read '$0'\n" and exit; | ||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=12 SCAR=39.3
Branch: 1 branch
Condition25%1/4
open(FH, "<$0") || print("Cannot read '$0'\n") && exit
print "Cannot read '$0'\n" and exit
MC/DC0%0/2
open(FH, "<$0") || print("Cannot read '$0'\n") && exit
open(FH, "<$0")
print "Cannot read '$0'\n"
Truth table33%1/3
A || B
A= open(FH, "<$0")B= print "Cannot read '$0'\n"
| |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | my $reg = $_[1] | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 31 | ? qr/(.*)\1^\s*use\s+Acme::DotDotGone\s+($_[1]);\n/ | ||||||||||||||||||||||||||||||||
| 32 | : qr/.*^\s*use\s+Acme::DotDotGone;\n/; | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 1 | ($_[2] = (join '', <FH>)) =~ s/$reg//sm; | |||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | $_[2] = $1 . $_[2] if $1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 1 | close FH; | |||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | ($_[2], $_[3], $_[4]) = (($2) | ||||||||||||||||||||||||||||||||
| 40 | ? ($2 eq 'dot') | ||||||||||||||||||||||||||||||||
| 41 | ? sub { | ||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | $_[1] = $dots{toDots}($_[0]); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 43 | 0 | $_[0], $_[1], $_[1]; | |||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||
| 45 | : sub { | ||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | $_[1] = $dots{fromDots}($_[0]); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 47 | 0 | $_[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 | 0 | ▶ | $_[1] = $dots{fromDots}($_[0]); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 55 | 0 | $_[1], $_[0]; | |||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | )->($_[2]); | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | if ($_[4]) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | open FH, ">$0" or print "Cannot encode. '$0'\n" and exit; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
open(FH, ">$0") || print("Cannot encode. '$0'\n") && exit
print "Cannot encode. '$0'\n" and exit
MC/DC0%0/2
open(FH, ">$0") || print("Cannot encode. '$0'\n") && exit
open(FH, ">$0")
print "Cannot encode. '$0'\n"
Truth table0%0/3
A || B
A= open(FH, ">$0")B= print "Cannot encode. '$0'\n"
| |||||||||||||||||||||||||||||||||
| 61 | 0 | print FH "use Acme::DotDotGone;\n"; | |||||||||||||||||||||||||||||||
| 62 | 0 | print FH $_[4]; | |||||||||||||||||||||||||||||||
| 63 | 0 | close FH; | |||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 1 | ▶ | do { eval "$_[2]"; $dots{stderr}($@); } if $_[2]; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 1 | 1; | |||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||||||