}
# Prompt for subject of message, if needed
+
+ if (TrivialSubject($subject)) {
+ $subject = '';
+ }
+
unless ($subject) {
paraprint <<EOF;
First of all, please provide a subject for the
the bug or problem. "perl bug" or "perl problem"
is not a concise description.
EOF
- print "Subject: ";
- $subject = <>;
my $err = 0;
- while ($subject !~ /\S/) {
- print "\nPlease enter a subject: ";
+ do {
+ print "Subject: ";
$subject = <>;
- if ($err++ > 5) {
+ chomp $subject;
+ if ($err++ == 5) {
die "Aborting.\n";
}
- }
- chop $subject;
+ } while (TrivialSubject($subject));
}
# Prompt for return address, if needed
# verify it
print "Your address [$guess]: ";
$from = <>;
- chop $from;
+ chomp $from;
$from = $guess if $from eq '';
}
}
EOF
print "Local perl administrator [$cc]: ";
my $entry = scalar <>;
- chop $entry;
+ chomp $entry;
if ($entry ne "") {
$cc = $entry;
EOF
print "Editor [$ed]: ";
my $entry =scalar <>;
- chop $entry;
+ chomp $entry;
$usefile = 0;
if ($entry eq "file") {
EOF
print "Filename: ";
my $entry = scalar <>;
- chop $entry;
+ chomp $entry;
if ($entry eq "") {
paraprint <<EOF;
EOF
print "Editor [$ed]: ";
my $entry =scalar <>;
- chop $entry;
+ chomp $entry;
$ed = $entry unless $entry eq '';
}
EOF
print "Editor [$ed]: ";
my $entry =scalar <>;
- chop $entry;
+ chomp $entry;
if ($entry ne "") {
$ed = $entry;
paraprint <<EOF;
Now that you have completed your report, would you like to send
the message to $address$andcc, display the message on
-the screen, re-edit it, or cancel without sending anything?
+the screen, re-edit it, display/change the subject,
+or cancel without sending anything?
You may also save the message as a file to mail at another time.
EOF
retry:
- print "Action (Send/Display/Edit/Cancel/Save to File): ";
+ print "Action (Send/Display/Edit/Subject/Save to File): ";
my $action = scalar <>;
- chop $action;
+ chomp $action;
if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve
my $file_save = $outfile || "perlbug.rep";
print "\n\nName of file to save message in [$file_save]: ";
my $file = scalar <>;
- chop $file;
+ chomp $file;
$file = $file_save if $file eq "";
unless (open(FILE, ">$file")) {
open(REP, "<$filename") or die "Couldn't open file `$filename': $!\n";
while (<REP>) { print $_ }
close(REP) or die "Error closing report file `$filename': $!";
+ } elsif ($action =~ /^su/i) { # <Su>bject
+ print "Subject: $subject\n";
+ print "If the above subject is fine, just press Enter.\n";
+ print "If not, type in the new subject.\n";
+ print "Subject: ";
+ my $reply = scalar <STDIN>;
+ chomp $reply;
+ if ($reply ne '') {
+ unless (TrivialSubject($reply)) {
+ $subject = $reply;
+ print "Subject: $subject\n";
+ }
+ }
} elsif ($action =~ /^se/i) { # <S>end
# Send the message
print "Are you certain you want to send this message?\n"
. 'Please type "yes" if you are: ';
my $reply = scalar <STDIN>;
- chop $reply;
+ chomp $reply;
if ($reply eq "yes") {
last;
} else {
}
} # sub NowWhat
+sub TrivialSubject {
+ my $subject = shift;
+ if ($subject =~
+ /^(y(es)?|no?|help|perl( (bug|problem))?|bug|problem)$/i ||
+ length($subject) < 4 ||
+ $subject !~ /\s/) {
+ print "\nThat doesn't look like a good subject. Please be more verbose.\n\n";
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
sub Send {
# Message has been accepted for transmission -- Send the message
if ($outfile) {