From: Hugo van der Sanden Date: Wed, 1 Jul 1998 21:14:22 +0000 (+0200) Subject: add perlbug -F switch to save message to file X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=105f9295f78e59680043922daac4ef6085834045;p=p5sagit%2Fp5-mst-13.2.git add perlbug -F switch to save message to file Message-Id: Subject: Re: [PATCH 5.004_69] perlbug -fok p4raw-id: //depot/perl@1294 --- diff --git a/Makefile.SH b/Makefile.SH index e4323b7..7e9e384 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -589,6 +589,9 @@ minitest: miniperl ok: utilities $(LBLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' +okfile: utilities + $(LBLIBPTH) ./perl -Ilib utils/perlbug -ok -s '(UNINSTALLED)' -F perl.ok + nok: utilities $(LBLIBPTH) ./perl -Ilib utils/perlbug -nok -s '(UNINSTALLED)' diff --git a/utils/perlbug.PL b/utils/perlbug.PL index 8f2c679..1a39bdb 100644 --- a/utils/perlbug.PL +++ b/utils/perlbug.PL @@ -86,7 +86,7 @@ BEGIN { $::HaveUtil = ($@ eq ""); }; -my $Version = "1.23"; +my $Version = "1.24"; # 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. @@ -114,6 +114,7 @@ my $Version = "1.23"; # Changed in 1.21 Added '-nok' for reporting build failure DFD 98-05-05 # Changed in 1.22 Heavy reformatting & minor bugfixes HVDS 98-05-10 # Changed in 1.23 Restore -ok(ay): say 'success'; don't prompt +# Changed in 1.24 Added '-F' to save report HVDS 98-07-01 # TODO: - Allow the user to re-name the file on mail failure, and # make sure failure (transmission-wise) of Mail::Send is @@ -121,7 +122,7 @@ my $Version = "1.23"; # - Test -b option my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, - $subject, $from, $verbose, $ed, + $subject, $from, $verbose, $ed, $outfile, $fh, $me, $Is_MSWin32, $Is_VMS, $msg, $body, $andcc, %REP, $ok); my $config_tag2 = "$] - $Config{cf_time}"; @@ -137,7 +138,7 @@ include a file, you can use the -f switch. EOF die "\n"; } -if (!-t STDOUT) { Dump(*STDOUT); exit; } +if (!-t STDOUT && !$outfile) { Dump(*STDOUT); exit; } Query(); Edit() unless $usefile || ($ok and not $::opt_n); @@ -152,7 +153,7 @@ sub Init { $Is_MSWin32 = $^O eq 'MSWin32'; $Is_VMS = $^O eq 'VMS'; - getopts("dhva:s:b:f:r:e:SCc:to:n:"); + getopts("dhva:s:b:f:F:r:e:SCc:to:n:"); # This comment is needed to notify metaconfig that we are # using the $perladmin, $cf_by, and $cf_time definitions. @@ -183,6 +184,9 @@ sub Init { # File to send as report $file = $::opt_f || ""; + # File to output to + $outfile = $::opt_F || ""; + # Body of report $body = $::opt_b || ""; @@ -677,6 +681,10 @@ EOF sub Send { # Message has been accepted for transmission -- Send the message + if ($outfile) { + open SENDMAIL, ">$outfile" or die "Couldn't open '$outfile': $!\n"; + goto sendout; + } if ($::HaveSend) { $msg = new Mail::Send Subject => $subject, To => $address; $msg->cc($cc) if $cc; @@ -731,6 +739,7 @@ So you may attempt to find some way of sending your message, it has been left in the file `$filename'. EOF open(SENDMAIL, "|$sendmail -t") || die "'|$sendmail -t' failed: $!"; +sendout: print SENDMAIL "To: $address\n"; print SENDMAIL "Subject: $subject\n"; print SENDMAIL "Cc: $cc\n" if $cc; @@ -741,7 +750,7 @@ EOF close(REP); if (close(SENDMAIL)) { - print "\nMessage sent.\n"; + printf "\nMessage %s.\n", $outfile ? "saved" : "sent"; } else { warn "\nSendmail returned status '", $? >> 8, "'\n"; } @@ -757,7 +766,7 @@ It is designed to be used interactively. Normally no arguments will be needed. Usage: -$0 [-v] [-a address] [-s subject] [-b body | -f file ] +$0 [-v] [-a address] [-s subject] [-b body | -f inpufile ] [ -F outputfile ] [-r returnaddress] [-e editor] [-c adminaddress | -C] [-S] [-t] [-h] $0 [-v] [-r returnaddress] [-ok | -okay | -nok | -nokay] @@ -768,6 +777,7 @@ Options: -v Include Verbose configuration data in the report -f File containing the body of the report. Use this to quickly send a prepared message. + -F File to output the resulting mail message to, instead of mailing. -S Send without asking for confirmation. -a Address to send the report to. Defaults to `$address'. -c Address to send copy of report to. Defaults to `$cc'. @@ -830,7 +840,8 @@ perlbug - how to submit bug reports on Perl =head1 SYNOPSIS B S<[ B<-v> ]> S<[ B<-a> I
]> S<[ B<-s> I ]> -S<[ B<-b> I | B<-f> I ]> S<[ B<-r> I ]> +S<[ B<-b> I | B<-f> I ]> S<[ B<-F> I ]> +S<[ B<-r> I ]> S<[ B<-e> I ]> S<[ B<-c> I | B<-C> ]> S<[ B<-S> ]> S<[ B<-t> ]> S<[ B<-d> ]> S<[ B<-h> ]> @@ -986,6 +997,12 @@ Editor to use. File containing the body of the report. Use this to quickly send a prepared message. +=item B<-F> + +File to output the results to instead of sending as an email. Useful +particularly when running perlbug on a machine with no direct internet +connection. + =item B<-h> Prints a brief summary of the options.