diff options
author | Hugo van der Sanden <hv@crypt.org> | 1998-07-01 23:14:22 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-04 05:10:25 +0000 |
commit | 105f9295f78e59680043922daac4ef6085834045 (patch) | |
tree | 9ac58af4a60b925b4a32631d8e906249cd707905 | |
parent | ef64f398041e39403718b830b0e15752f4a1cfbf (diff) | |
download | perl-105f9295f78e59680043922daac4ef6085834045.tar.gz |
add perlbug -F switch to save message to file
Message-Id: <l03130301b1c03a649e45@[194.222.64.89]>
Subject: Re: [PATCH 5.004_69] perlbug -fok
p4raw-id: //depot/perl@1294
-rw-r--r-- | Makefile.SH | 3 | ||||
-rw-r--r-- | utils/perlbug.PL | 31 |
2 files changed, 27 insertions, 7 deletions
diff --git a/Makefile.SH b/Makefile.SH index e4323b7144..7e9e384603 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 8f2c679f7c..1a39bdbe96 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<file>' 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<perlbug> S<[ B<-v> ]> S<[ B<-a> I<address> ]> S<[ B<-s> I<subject> ]> -S<[ B<-b> I<body> | B<-f> I<file> ]> S<[ B<-r> I<returnaddress> ]> +S<[ B<-b> I<body> | B<-f> I<inputfile> ]> S<[ B<-F> I<outputfile> ]> +S<[ B<-r> I<returnaddress> ]> S<[ B<-e> I<editor> ]> S<[ B<-c> I<adminaddress> | 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. |