blib/lib/ShellQuote/Any/Tiny.pm

filter: Statementstmt 78.2% 18 / 23 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 68.4% 26 / 38 CC 5 SCAR 17.6
CC
5
Cov
69%
shell_quote
7.7
BEGIN
1.0
BEGIN
1.0
CRAP 5.8
↑ Summary
1 package ShellQuote::Any::Tiny;
2  
3 2 our $DATE = '2017-09-20'; # DATE
4 2 our $VERSION = '0.007'; # VERSION
5  
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 #use warnings;
8  
9 2 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 our @EXPORT_OK = qw(shell_quote);
11 2 our $OS;
12  
13 14 ▶sub shell_quote {
Subroutine shell_quote: called CC=5 SCAR=20.4
Pod documented
14 14 my $arg = shift;
15  
16 14 ▶ my $os = $OS || $^O;
Condition33%1/3
$ShellQuote::Any::Tiny::OS || $^O
l!l&&r!l&&!r
0140
MC/DC0%0/2
$ShellQuote::Any::Tiny::OS || $^O
$ShellQuote::Any::Tiny::OS $^O
Truth table33%1/3
A || B
A= $ShellQuote::Any::Tiny::OSB= $^O
ABresult
1X1
011
000
17  
18 14 ▶ if ($os eq 'MSWin32') {
Branch: 1 branch
BranchTrueFalseTotal
if ($os eq 'MSWin32') { } 0 14 14
19 0 ▶ if ($arg =~ /\A\w+\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /\A\w+\z/) 0 0 0
20 0 return $arg;
21 }
22 0 $arg =~ s/\\(?=\\*(?:"|$))/\\\\/g;
23 0 $arg =~ s/"/\\"/g;
24 0 return qq("$arg");
25 } else {
26 14 ▶ if ($arg =~ /\A\w+\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /\A\w+\z/) 1 13 14
27 1 return $arg;
28 }
29 13 $arg =~ s/'/'"'"'/g;
30 13 return "'$arg'";
31 }
32 }
33  
34 2 1;
35 # ABSTRACT: Escape string for the Unix/Windows shell
36  
37 __END__
↑ Summary