From: Gurusamy Sarathy Date: Mon, 20 Mar 2000 21:59:51 +0000 (+0000) Subject: perlbugtron flags in perlbug (from Richard Foley); eliminate duplicate X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50d3c28bbe8a45c1810f69952fd525ff16664a9c;p=p5sagit%2Fp5-mst-13.2.git perlbugtron flags in perlbug (from Richard Foley); eliminate duplicate code p4raw-id: //depot/perl@5842 --- diff --git a/utils/perlbug.PL b/utils/perlbug.PL index f6280d2..f6d3dc0 100644 --- a/utils/perlbug.PL +++ b/utils/perlbug.PL @@ -91,7 +91,7 @@ BEGIN { $::HaveUtil = ($@ eq ""); }; -my $Version = "1.27"; +my $Version = "1.28"; # Changed in 1.06 to skip Mail::Send and Mail::Util if not available. # Changed in 1.07 to see more sendmail execs, and added pipe output. @@ -123,6 +123,7 @@ my $Version = "1.27"; # Changed in 1.25 Warn on failure to open save file. HVDS 98-07-12 # Changed in 1.26 Don't require -t STDIN for -ok. HVDS 98-07-15 # Changed in 1.27 Added Mac OS and File::Spec support CNANDOR 99-07-27 +# Changed in 1.28 Additional questions for Perlbugtron RFOLEY 20.03.2000 # TODO: - Allow the user to re-name the file on mail failure, and # make sure failure (transmission-wise) of Mail::Send is @@ -130,7 +131,7 @@ my $Version = "1.27"; # - Test -b option my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, - $subject, $from, $verbose, $ed, $outfile, $Is_MacOS, + $subject, $from, $verbose, $ed, $outfile, $Is_MacOS, $category, $severity, $fh, $me, $Is_MSWin32, $Is_VMS, $msg, $body, $andcc, %REP, $ok); my $perl_version = $^V ? sprintf("v%vd", $^V) : $]; @@ -157,6 +158,33 @@ Send(); exit; +sub ask_for_alternatives { + my $name = shift; + my $default = shift; + my @alts = @_; + my $alt = ""; + paraprint < 5) { + die "Invalid $name: aborting.\n"; + } + print "Please enter a \u$name [$default]: "; + $alt = <>; + chomp $alt; + if ($alt =~ /^\s*$/) { + $alt = $default; + } + } while ($alt !~ /^($joined_alts)$/i); + lc $alt; +} + sub Init { # -------- Setup -------- @@ -437,6 +465,16 @@ EOF } } + # Prompt for category of bug + $category ||= ask_for_alternatives("category", "core", + qw(core docs install + library utilities)); + + # Prompt for severity of bug + $severity ||= ask_for_alternatives("severity", "low", + qw(critical high medium + low wishlist none)); + # Generate scratch file to edit report in $filename = filename(); @@ -516,8 +554,14 @@ EOF sub Dump { local(*OUT) = @_; - print REP "\n---\n"; - print REP "This perlbug was built using Perl $config_tag1\n", + print OUT <gsar@activestate.comE), Tom Christiansen Charles F. Randall (Ecfr@pobox.comE), Mike Guy (Emjtg@cam.a.ukE), Dominic Dunlop (Edomo@computer.orgE), Hugo van der Sanden (Ehv@crypt0.demon.co.ukE), -Jarkko Hietaniemi (Ejhi@iki.fiE), hris Nandor -(Epudge@pobox.comE), and Jon Orwant (Eorwant@media.mit.eduE). +Jarkko Hietaniemi (Ejhi@iki.fiE), Chris Nandor +(Epudge@pobox.comE), Jon Orwant (Eorwant@media.mit.eduE, +and Richard Foley (Erichard@rfi.netE). =head1 SEE ALSO