blib/lib/Git/Deploy/Question.pm

filter: Statementstmt 68.0% 17 / 25 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 59.4% 22 / 37 CC 5 SCAR 27.4
CC
5
Cov
55%
_question
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 15.5
« bin/git-deploy ↑ Summary lib/Git/Deploy/Timing.pm »
1 package Git::Deploy::Question;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings FATAL => "all";
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Term::ReadLine;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Git::Deploy::Say;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our @EXPORT = qw(
9 _question
10 );
11  
12 0 ▶sub _question {
Subroutine _question: not called CC=5 SCAR=34.0
13 0 my %opts = (
14 question => "Continue anyway? [Y/n]",
15 answer_positive => qr/^Y(?:es)?/i,
16 answer_negative => qr/^N(?:o)?/i,
17  
18 @_, # this goes last, for hobo default overriding
19 );
20  
21 0 my $term = Term::ReadLine->new($0);
22 0 ▶ while (defined (my $line = $term->readline("$opts{question}> "))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = $term->readline(qq[$opts{"question"}> ]))) 0 0 0
23 0 for ($line) {
24 0 ▶ if ( /$opts{answer_positive}/ ) { return 1 }
Branch: 2 branches
BranchTrueFalseTotal
if (/$opts{'answer_positive'}/) { } 0 0 0
elsif (/$opts{'answer_negative'}/) { } 0 0 0
25 0 elsif ( /$opts{answer_negative}/ ) { return 0 }
26 else {
27 0 _warn "I can't understand you, try again\n";
28 }
29 }
30 }
31 }
32  
33 1 1;
« bin/git-deploy ↑ Summary lib/Git/Deploy/Timing.pm »