diff options
author | mkanat%bugzilla.org <> | 2009-02-23 23:00:38 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-02-23 23:00:38 +0100 |
commit | 61e26c1346d60a18946e50a35f95bfe3f223d408 (patch) | |
tree | 1602d84227c10902343e2aa575ac32ba1136858b | |
parent | 367a969471b0f8ae940410f97beae4e300d0b81d (diff) | |
download | bugzilla-61e26c1346d60a18946e50a35f95bfe3f223d408.tar.gz bugzilla-61e26c1346d60a18946e50a35f95bfe3f223d408.tar.xz |
Bug 476607: "Constant subroutine redefined" warnings from Bugzilla::Field::Choice
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
-rw-r--r-- | Bugzilla/Field/Choice.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm index 5f1578d2b..fe5c7bdcb 100644 --- a/Bugzilla/Field/Choice.pm +++ b/Bugzilla/Field/Choice.pm @@ -93,18 +93,18 @@ sub type { # For generic classes, we use a lowercase class name, so as # not to interfere with any real subclasses we might make some day. my $package = "Bugzilla::Field::Choice::$field_name"; + Bugzilla->request_cache->{"field_$package"} = $field_obj; - # We check defined so that the package and the stored field are only - # created once globally (at least per request). We prefix it with - # field_ (instead of suffixing it) so that we don't somehow conflict - # with the names of custom fields. - if (!defined Bugzilla->request_cache->{"field_$package"}) { + # This package only needs to be created once. We check if the DB_TABLE + # glob for this package already exists, which tells us whether or not + # we need to create the package (this works even under mod_perl, where + # this package definition will persist across requests)). + if (!defined *{"${package}::DB_TABLE"}) { eval <<EOC; package $package; use base qw(Bugzilla::Field::Choice); use constant DB_TABLE => '$field_name'; EOC - Bugzilla->request_cache->{"field_$package"} = $field_obj; } return $package; |