diff options
Diffstat (limited to 'contrib/sendbugmail.pl')
-rwxr-xr-x | contrib/sendbugmail.pl | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/contrib/sendbugmail.pl b/contrib/sendbugmail.pl index 223d91f6c..b1b5fa8a5 100755 --- a/contrib/sendbugmail.pl +++ b/contrib/sendbugmail.pl @@ -20,16 +20,16 @@ use Bugzilla::User; my $dbh = Bugzilla->dbh; sub usage { - say STDERR "Usage: $0 bug_id user_email"; - exit; + say STDERR "Usage: $0 bug_id user_email"; + exit; } if (($#ARGV < 1) || ($#ARGV > 2)) { - usage(); + usage(); } # Get the arguments. -my $bugnum = $ARGV[0]; +my $bugnum = $ARGV[0]; my $changer = $ARGV[1]; # Validate the bug number. @@ -40,8 +40,8 @@ if (!($bugnum =~ /^(\d+)$/)) { detaint_natural($bugnum); -my ($id) = $dbh->selectrow_array("SELECT bug_id FROM bugs WHERE bug_id = ?", - undef, $bugnum); +my ($id) = $dbh->selectrow_array("SELECT bug_id FROM bugs WHERE bug_id = ?", + undef, $bugnum); if (!$id) { say STDERR "Bug number $bugnum does not exist."; @@ -51,25 +51,26 @@ if (!$id) { # Validate the changer address. my $match = Bugzilla->params->{'emailregexp'}; if ($changer !~ /$match/) { - say STDERR "Changer \"$changer\" doesn't match email regular expression."; - usage(); + say STDERR "Changer \"$changer\" doesn't match email regular expression."; + usage(); } -my $changer_user = new Bugzilla::User({ name => $changer }); +my $changer_user = new Bugzilla::User({name => $changer}); unless ($changer_user) { - say STDERR "\"$changer\" is not a valid user."; - usage(); + say STDERR "\"$changer\" is not a valid user."; + usage(); } # Send the email. -my $outputref = Bugzilla::BugMail::Send($bugnum, {'changer' => $changer_user }); +my $outputref = Bugzilla::BugMail::Send($bugnum, {'changer' => $changer_user}); # Report the results. my $sent = scalar(@{$outputref->{sent}}); if ($sent) { - say "email sent to $sent recipients:"; -} else { - say "No email sent."; + say "email sent to $sent recipients:"; +} +else { + say "No email sent."; } foreach my $sent (@{$outputref->{sent}}) { @@ -78,12 +79,12 @@ foreach my $sent (@{$outputref->{sent}}) { # This document is copyright (C) 2004 Perforce Software, Inc. All rights # reserved. -# +# # Redistribution and use of this document in any form, with or without # modification, is permitted provided that redistributions of this # document retain the above copyright notice, this condition and the # following disclaimer. -# +# # THIS DOCUMENT IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |