line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Deploy::Question; |
2
|
1
|
|
|
1
|
|
2551
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
130
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings FATAL => "all"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
7
|
use Exporter 'import'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
1312
|
use Term::ReadLine; |
|
1
|
|
|
|
|
5181
|
|
|
1
|
|
|
|
|
44
|
|
6
|
1
|
|
|
1
|
|
1206
|
use Git::Deploy::Say; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
810
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw( |
9
|
|
|
|
|
|
|
_question |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _question { |
13
|
0
|
|
|
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}> "))) { |
23
|
0
|
|
|
|
|
|
for ($line) { |
24
|
0
|
0
|
|
|
|
|
if ( /$opts{answer_positive}/ ) { return 1 } |
|
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; |