From ffccea292395f8c60abdfe4a8b3a268f1f0b7a31 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sun, 23 Mar 2014 12:10:04 -0400 Subject: stop using List::MoreUtils::first_index --- lib/Dist/CheckConflicts.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Dist/CheckConflicts.pm b/lib/Dist/CheckConflicts.pm index 9cf8729..9f9b4cd 100644 --- a/lib/Dist/CheckConflicts.pm +++ b/lib/Dist/CheckConflicts.pm @@ -10,7 +10,6 @@ our @EXPORT = our @EXPORT_OK = ( ); use Carp; -use List::MoreUtils 0.12 'first_index'; use Module::Runtime 0.009 'module_notional_filename', 'require_module'; =head1 SYNOPSIS @@ -174,13 +173,14 @@ sub import { sub _strip_opt { my ($opt, @args) = @_; - my $idx = first_index { ( $_ || '' ) eq $opt } @args; - return ( undef, @args ) unless $idx >= 0 && $#args >= $idx + 1; - - my $val = $args[ $idx + 1 ]; - - splice @args, $idx, 2; + my $val; + for my $idx ( 0 .. $#args - 1 ) { + if (defined $args[$idx] && $args[$idx] eq $opt) { + $val = (splice @args, $idx, 2)[1]; + last; + } + } return ( $val, @args ); } -- cgit v1.2.3-54-g00ecf