summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-04-03 10:27:25 -0600
committerKarl Williamson <khw@cpan.org>2018-04-15 16:48:46 -0600
commitfbb64cf55d4ec47a6b340862d7902f06b7a1ddc8 (patch)
tree33a3e491a621e03a2fcec8a7e1419402d3f68c6a /utils
parent2407a17ad5d780a1625dddfb668056ab05459194 (diff)
downloadperl-fbb64cf55d4ec47a6b340862d7902f06b7a1ddc8.tar.gz
perlbug: Ask confirmation if would overwrite existing file
This adds a prompt asking for confirmation if the perlbug report would overwrite an existing file. My guess is that the normal answer will be yes.
Diffstat (limited to 'utils')
-rw-r--r--utils/perlbug.PL4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/perlbug.PL b/utils/perlbug.PL
index 3273902d0b..d1eb1e04a8 100644
--- a/utils/perlbug.PL
+++ b/utils/perlbug.PL
@@ -1122,6 +1122,10 @@ sub build_complete_message {
sub save_message_to_disk {
my $file = shift;
+ if (-e $file) {
+ my $response = _prompt( '', "Overwrite existing '$file'", 'n' );
+ return undef unless $response =~ / yes | y /xi;
+ }
open OUTFILE, '>:raw', $file or do { warn "Couldn't open '$file': $!\n"; return undef};
binmode(OUTFILE, ':raw :crlf') if $Is_MSWin32;