summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTodd Rinaldo <toddr@cpan.org>2017-11-10 11:13:09 -0600
committerTodd Rinaldo <toddr@cpan.org>2017-11-10 15:25:07 -0600
commit7b1af8a66568cbb1b215ecb17fa5f19059208f55 (patch)
tree02a855bee71264a4d67460981998f93d610256d5 /utils
parent4f8ef02eaa8580534cef12a44dbfc822b26786be (diff)
downloadperl-7b1af8a66568cbb1b215ecb17fa5f19059208f55.tar.gz
Add support for --help and --version in perlbug
RT 130032: Thanks to Houston Perl Mongers for contributing to this work at our monthly meeting! NPD
Diffstat (limited to 'utils')
-rw-r--r--utils/perlbug.PL28
1 files changed, 18 insertions, 10 deletions
diff --git a/utils/perlbug.PL b/utils/perlbug.PL
index 2a440cdec3..3273902d0b 100644
--- a/utils/perlbug.PL
+++ b/utils/perlbug.PL
@@ -65,6 +65,8 @@ use File::Spec; # keep perlbug Perl 5.005 compatible
use Getopt::Std;
use File::Basename 'basename';
+$Getopt::Std::STANDARD_HELP_VERSION = 1;
+
sub paraprint;
BEGIN {
@@ -81,7 +83,7 @@ BEGIN {
$::HaveWrap = ($@ eq "");
};
-my $Version = "1.40";
+our $VERSION = "1.41";
#TODO:
# make sure failure (transmission-wise) of Mail::Send is accounted for.
@@ -185,6 +187,9 @@ EOF
lc $alt;
}
+sub HELP_MESSAGE { Help(); exit; }
+sub VERSION_MESSAGE { print "perlbug version $VERSION\n"; }
+
sub Init {
# -------- Setup --------
@@ -193,13 +198,6 @@ sub Init {
$Is_Linux = lc($^O) eq 'linux';
$Is_OpenBSD = lc($^O) eq 'openbsd';
- if (!getopts("Adhva:s:b:f:F:r:e:SCc:to:n:T:p:", \%opt)) { Help(); exit; };
-
- # This comment is needed to notify metaconfig that we are
- # using the $perladmin, $cf_by, and $cf_time definitions.
-
- # -------- Configuration ---------
-
# perlbug address
$bugaddress = 'perlbug@perl.org';
@@ -209,6 +207,16 @@ sub Init {
# Thanks address
$thanksaddress = 'perl-thanks@perl.org';
+ # Defaults if getopts fails.
+ $address = (basename ($0) =~ /^perlthanks/i) ? $thanksaddress : $bugaddress;
+ $cc = $::Config{'perladmin'} || $::Config{'cf_email'} || $::Config{'cf_by'} || '';
+
+ HELP_MESSAGE() unless getopts("Adhva:s:b:f:F:r:e:SCc:to:n:T:p:", \%opt);
+
+ # This comment is needed to notify metaconfig that we are
+ # using the $perladmin, $cf_by, and $cf_time definitions.
+ # -------- Configuration ---------
+
if (basename ($0) =~ /^perlthanks/i) {
# invoked as perlthanks
$opt{T} = 1;
@@ -241,7 +249,7 @@ sub Init {
# We have one or more attachments
$have_attachment = ($opt{p} || 0);
- $mime_boundary = ('-' x 12) . "$Version.perlbug" if $have_attachment;
+ $mime_boundary = ('-' x 12) . "$VERSION.perlbug" if $have_attachment;
# Comma-separated list of attachments
$attachments = $opt{p} || "";
@@ -612,7 +620,7 @@ EOF
print REP <<EOF;
This is a $reptype report for perl from $from,
-generated with the help of perlbug $Version running under perl $perl_version.
+generated with the help of perlbug $VERSION running under perl $perl_version.
EOF