summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugMail.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-07-14 06:55:43 +0200
committermkanat%bugzilla.org <>2006-07-14 06:55:43 +0200
commit7f9a841d4ceeb5b6bb1648c702c2c753b1d75a51 (patch)
tree112e4eb1bcd323126b326da07ab34b8cf2258a28 /Bugzilla/BugMail.pm
parent9f7ba4e2a5a3b7a4a22e160343b7571058736199 (diff)
downloadbugzilla-7f9a841d4ceeb5b6bb1648c702c2c753b1d75a51.tar.gz
bugzilla-7f9a841d4ceeb5b6bb1648c702c2c753b1d75a51.tar.xz
Bug 343338: Eliminate "my" variables from the root level of modules
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r--Bugzilla/BugMail.pm42
1 files changed, 23 insertions, 19 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index ddcf4791e..3597b3f46 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -49,25 +49,28 @@ use constant BIT_WATCHING => 2;
# We need these strings for the X-Bugzilla-Reasons header
# Note: this hash uses "," rather than "=>" to avoid auto-quoting of the LHS.
-my %rel_names = (REL_ASSIGNEE , "AssignedTo",
- REL_REPORTER , "Reporter",
- REL_QA , "QAcontact",
- REL_CC , "CC",
- REL_VOTER , "Voter");
-
-# This code is really ugly. It was a commandline interface, then it was moved.
-# This really needs to be cleaned at some point.
-
-my %nomail;
-
-# This is run when we load the package
-if (open(NOMAIL, '<', bz_locations->{'datadir'} . "/nomail")) {
- while (<NOMAIL>) {
- $nomail{trim($_)} = 1;
+use constant REL_NAMES => {
+ REL_ASSIGNEE, "AssignedTo",
+ REL_REPORTER, "Reporter",
+ REL_QA , "QAcontact",
+ REL_CC , "CC",
+ REL_VOTER , "Voter"
+};
+
+sub _read_nomail {
+ my $nomail = Bugzilla->request_cache->{bugmail_nomail};
+ return $nomail if $nomail;
+ if (open(NOMAIL, '<', bz_locations->{'datadir'} . "/nomail")) {
+ while (<NOMAIL>) {
+ $nomail->{trim($_)} = 1;
+ }
+ close(NOMAIL);
}
- close(NOMAIL);
+ Bugzilla->request_cache->{bugmail_nomail} = $nomail;
+ return $nomail;
}
+
sub FormatTriple {
my ($a, $b, $c) = (@_);
$^A = "";
@@ -462,7 +465,8 @@ sub ProcessOneBug {
# Make sure the user isn't in the nomail list, and the insider and
# dep checks passed.
- if ((!$nomail{$user->login}) &&
+ my $nomail = _read_nomail();
+ if ((!$nomail->{$user->login}) &&
$insider_ok &&
$dep_ok)
{
@@ -625,8 +629,8 @@ sub sendMail {
$substs{"summary"} = $values{'short_desc'};
my (@headerrel, @watchingrel);
while (my ($rel, $bits) = each %{$relRef}) {
- push @headerrel, ($rel_names{$rel}) if ($bits & BIT_DIRECT);
- push @watchingrel, ($rel_names{$rel}) if ($bits & BIT_WATCHING);
+ push @headerrel, (REL_NAMES->{$rel}) if ($bits & BIT_DIRECT);
+ push @watchingrel, (REL_NAMES->{$rel}) if ($bits & BIT_WATCHING);
}
push @headerrel, 'None' if !scalar(@headerrel);
push @watchingrel, 'None' if !scalar(@watchingrel);