Skip to content

Commit 670aa97

Browse files
authored
addbib: -p option handling (#472)
* If file argument '0' was given to the -p option, it was incorrectly ignored * extra1: remove warnings.pm as done in other scripts * extra2: simplify prompt input regex by writing it as a character group; found by perlcritic
1 parent 46077ed commit 670aa97

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

bin/addbib

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ License: perl
1313

1414

1515
use strict;
16-
use warnings;
1716
use Getopt::Std;
1817
use vars qw($opt_a $opt_p);
1918

@@ -34,7 +33,7 @@ my @prompts = (
3433
"Keywords:\t%K",
3534
);
3635

37-
if ($opt_p) {
36+
if (defined $opt_p) {
3837
@prompts = ();
3938
open my $PROMPTFILE, '<', $opt_p or die "can't read $opt_p: $!";
4039
foreach (<$PROMPTFILE>) {
@@ -113,7 +112,7 @@ while (1) {
113112
print "Continue? (y) ";
114113
$_ = <>;
115114
}
116-
last if /^(n|q)/i;
115+
last if m/\A[nq]/i;
117116
}
118117

119118
close $DATABASE or die "can't close $database: $!";

0 commit comments

Comments
 (0)