diff options
author | mkanat%bugzilla.org <> | 2006-07-14 06:55:43 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2006-07-14 06:55:43 +0200 |
commit | 7f9a841d4ceeb5b6bb1648c702c2c753b1d75a51 (patch) | |
tree | 112e4eb1bcd323126b326da07ab34b8cf2258a28 /Bugzilla/Search | |
parent | 9f7ba4e2a5a3b7a4a22e160343b7571058736199 (diff) | |
download | bugzilla-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/Search')
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index eba9bac01..1c0f4250b 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -33,7 +33,8 @@ use base qw(Exporter); @Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch); # Word renamings -my %mappings = (# Status, Resolution, Platform, OS, Priority, Severity +use constant MAPPINGS => { + # Status, Resolution, Platform, OS, Priority, Severity "status" => "bug_status", "resolution" => "resolution", # no change "platform" => "rep_platform", @@ -83,28 +84,33 @@ my %mappings = (# Status, Resolution, Platform, OS, Priority, Severity "attachmentdata" => "attach_data.thedata", "attachdata" => "attach_data.thedata", "attachmentmimetype" => "attachments.mimetype", - "attachmimetype" => "attachments.mimetype"); + "attachmimetype" => "attachments.mimetype" +}; # We might want to put this into localconfig or somewhere -my @platforms = ('pc', 'sun', 'macintosh', 'mac'); -my @productExceptions = ('row' # [Browser] - # ^^^ - ,'new' # [MailNews] - # ^^^ - ); -my @componentExceptions = ('hang' # [Bugzilla: Component/Keyword Changes] - # ^^^^ - ); +use constant PLATFORMS => ('pc', 'sun', 'macintosh', 'mac'); +use constant PRODUCT_EXCEPTIONS => ( + 'row', # [Browser] + # ^^^ + 'new', # [MailNews] + # ^^^ +); +use constant COMPONENT_EXCEPTIONS => ( + 'hang' # [Bugzilla: Component/Keyword Changes] + # ^^^^ +); # Quicksearch-wide globals for boolean charts. -my $chart = 0; -my $and = 0; -my $or = 0; +our ($chart, $and, $or); sub quicksearch { my ($searchstring) = (@_); my $cgi = Bugzilla->cgi; + $chart = 0; + $and = 0; + $or = 0; + # Remove leading and trailing commas and whitespace. $searchstring =~ s/(^[\s,]+|[\s,]+$)//g; ThrowUserError('buglist_parameters_required') unless ($searchstring); @@ -268,8 +274,8 @@ sub quicksearch { my @values = split(/,/, $2); foreach my $field (@fields) { # Be tolerant about unknown fields - next unless defined($mappings{$field}); - $field = $mappings{$field}; + next unless defined(MAPPINGS->{$field}); + $field = MAPPINGS->{$field}; foreach (@values) { addChart($field, 'substring', $_, $negate); } @@ -282,7 +288,7 @@ sub quicksearch { # by comma, which is another legal boolean OR indicator. foreach my $word (split(/,/, $or_operand)) { # Platform - if (grep({lc($word) eq $_} @platforms)) { + if (grep({lc($word) eq $_} PLATFORMS)) { addChart('rep_platform', 'substring', $word, $negate); } @@ -311,14 +317,14 @@ sub quicksearch { else { # Default QuickSearch word if (!grep({lc($word) eq $_} - @productExceptions) && + PRODUCT_EXCEPTIONS) && length($word)>2 ) { addChart('product', 'substring', $word, $negate); } if (!grep({lc($word) eq $_} - @componentExceptions) && + COMPONENT_EXCEPTIONS) && length($word)>2 ) { addChart('component', 'substring', |