summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Migrate
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:02:17 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:02:17 +0200
commit271477d8c26794abd8310e2abb89b746204660af (patch)
treea4701a52f9ff1918e25a75e09267bfba0b063296 /Bugzilla/Migrate
parent3417cb73db6d2306a012d3c624e9bec92fa1a161 (diff)
downloadbugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.gz
bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.xz
Bug 560009: Use firstidx from List::MoreUtils instead of lsearch
r=timello, a=mkanat
Diffstat (limited to 'Bugzilla/Migrate')
-rw-r--r--Bugzilla/Migrate/Gnats.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/Bugzilla/Migrate/Gnats.pm b/Bugzilla/Migrate/Gnats.pm
index 232100f2d..ff24f73b5 100644
--- a/Bugzilla/Migrate/Gnats.pm
+++ b/Bugzilla/Migrate/Gnats.pm
@@ -25,12 +25,13 @@ use base qw(Bugzilla::Migrate);
use Bugzilla::Constants;
use Bugzilla::Install::Util qw(indicate_progress);
-use Bugzilla::Util qw(format_time trim generate_random_password lsearch);
+use Bugzilla::Util qw(format_time trim generate_random_password);
use Email::Address;
use Email::MIME;
use File::Basename;
use IO::File;
+use List::MoreUtils qw(firstidx);
use List::Util qw(first);
use constant REQUIRED_MODULES => [
@@ -168,14 +169,14 @@ use constant NON_COMMENT_FIELDS => qw(
# we list out here the exact order of fields at the end of a PR
# and wait for the next field to consider that we actually have
# a field to parse.
-use constant END_FIELD_ORDER => [qw(
+use constant END_FIELD_ORDER => qw(
Description
How-To-Repeat
Fix
Release-Note
Audit-Trail
Unformatted
-)];
+);
use constant CUSTOM_FIELDS => {
cf_type => {
@@ -374,10 +375,12 @@ sub _get_gnats_field_data {
# If this is one of the last few PR fields, then make sure
# that we're getting our fields in the right order.
my $new_field_valid = 1;
- my $current_field_pos =
- lsearch(END_FIELD_ORDER, $current_field || '');
+ my $search_for = $current_field || '';
+ my $current_field_pos = firstidx { $_ eq $search_for }
+ END_FIELD_ORDER;
if ($current_field_pos > -1) {
- my $new_field_pos = lsearch(END_FIELD_ORDER, $new_field);
+ my $new_field_pos = firstidx { $_ eq $new_field }
+ END_FIELD_ORDER;
# We accept any field, as long as it's later than this one.
$new_field_valid = $new_field_pos > $current_field_pos ? 1 : 0;
}