From: Peter Rabbitson Date: Mon, 11 Apr 2016 11:31:18 +0000 (+0200) Subject: And lose yet another dependency: List::Util (yes, I know it's core) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=87b1255103d7b8873b225416cb381c50011f4c06;p=dbsrgits%2FDBIx-Class-Historic.git And lose yet another dependency: List::Util (yes, I know it's core) The main motivation for this is that first {} is an expensive subcall, whereas grep is a native fast opcode. Within the entire codebase there are pretty much no spots where we have so many elements to check, that the "check everything" of grep will overwhelm the expense of entersub (in fact 2 calls - one to first() itself, another to the block) As a side effect the removal of first(), which was the only thing we used that has known leaks prior to L::U 1.18, lets us drop the "5.8.8+ or later" List::Util dep entirely (it doesn't matter much for users, but it stresses the CI even more, which is a good thing) This cangeset should introduce 0 functional changes --- diff --git a/Makefile.PL b/Makefile.PL index ccd2769..9a4f074 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -42,13 +42,6 @@ my $runtime_requires = { ### 'DBI' => '1.57', - # on older versions first() leaks - # for the time being make it a hard dep - when we get - # rid of Sub::Name will revisit this (possibility is - # to use Devel::HideXS to force the pure-perl version - # or something like that) - 'List::Util' => '1.16', - # XS (or XS-dependent) libs 'Sub::Name' => '0.04', diff --git a/lib/DBIx/Class/Ordered.pm b/lib/DBIx/Class/Ordered.pm index 4c9a14c..8b84bd4 100644 --- a/lib/DBIx/Class/Ordered.pm +++ b/lib/DBIx/Class/Ordered.pm @@ -3,9 +3,6 @@ use strict; use warnings; use base qw( DBIx::Class ); -use List::Util 'first'; -use namespace::clean; - =head1 NAME DBIx::Class::Ordered - Modify the position of objects in an ordered list. @@ -564,7 +561,7 @@ sub update { if (! keys %$changed_ordering_cols) { return $self->next::method( undef, @_ ); } - elsif (defined first { exists $changed_ordering_cols->{$_} } @group_columns ) { + elsif (grep { exists $changed_ordering_cols->{$_} } @group_columns ) { $self->move_to_group( # since the columns are already re-set the _grouping_clause is correct # move_to_group() knows how to get the original storage values @@ -614,7 +611,11 @@ sub delete { # add the current position/group to the things we track old values for sub _track_storage_value { my ($self, $col) = @_; - return $self->next::method($col) || defined first { $_ eq $col } ($self->position_column, $self->_grouping_columns); + return ( + $self->next::method($col) + || + grep { $_ eq $col } ($self->position_column, $self->_grouping_columns) + ); } =head1 METHODS FOR EXTENDING ORDERED @@ -740,7 +741,7 @@ sub _shift_siblings { local $rsrc->schema->{_ORDERED_INTERNAL_UPDATE} = 1; my @pcols = $rsrc->primary_columns; if ( - first { $_ eq $position_column } ( map { @$_ } (values %{{ $rsrc->unique_constraints }} ) ) + grep { $_ eq $position_column } ( map { @$_ } (values %{{ $rsrc->unique_constraints }} ) ) ) { my $clean_rs = $rsrc->resultset; diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 71ff3ab..b51e05c 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -13,9 +13,6 @@ use DBIx::Class::_Util qw( ); use Try::Tiny; -# not importing first() as it will clash with our own method -use List::Util (); - BEGIN { # De-duplication in _merge_attr() is disabled, but left in for reference # (the merger is used for other things that ought not to be de-duped) @@ -466,7 +463,7 @@ sub search_rs { # see if we can keep the cache (no $rs changes) my $cache; my %safe = (alias => 1, cache => 1); - if ( ! List::Util::first { !$safe{$_} } keys %$call_attrs and ( + if ( ! grep { !$safe{$_} } keys %$call_attrs and ( ! defined $call_cond or ref $call_cond eq 'HASH' && ! keys %$call_cond @@ -490,9 +487,8 @@ sub search_rs { my @selector_attrs = qw/select as columns cols +select +as +columns include_columns/; # reset the current selector list if new selectors are supplied - if (List::Util::first { exists $call_attrs->{$_} } qw/columns cols select as/) { - delete @{$old_attrs}{(@selector_attrs, '_dark_selector')}; - } + delete @{$old_attrs}{(@selector_attrs, '_dark_selector')} + if grep { exists $call_attrs->{$_} } qw(columns cols select as); # Normalize the new selector list (operates on the passed-in attr structure) # Need to do it on every chain instead of only once on _resolved_attrs, in @@ -1888,7 +1884,7 @@ sub _rs_update_delete { $storage->_prune_unused_joins ($attrs); # any non-pruneable non-local restricting joins imply subq - $needs_subq = defined List::Util::first { $_ ne $attrs->{alias} } keys %{ $join_classifications->{restricting} || {} }; + $needs_subq = grep { $_ ne $attrs->{alias} } keys %{ $join_classifications->{restricting} || {} }; } # check if the head is composite (by now all joins are thrown out unless $needs_subq) @@ -3531,7 +3527,7 @@ sub _resolved_attrs { # default selection list $attrs->{columns} = [ $source->columns ] - unless List::Util::first { exists $attrs->{$_} } qw/columns cols select as/; + unless grep { exists $attrs->{$_} } qw/columns cols select as/; # merge selectors together for (qw/columns select as/) { @@ -3692,7 +3688,7 @@ sub _resolved_attrs { if ( ! $attrs->{_main_source_premultiplied} and - ! List::Util::first { ! $_->[0]{-is_single} } @fromlist + ! grep { ! $_->[0]{-is_single} } @fromlist ) { $attrs->{collapse} = 0; } @@ -3922,7 +3918,7 @@ sub _merge_joinpref_attr { }, ARRAY => sub { return $_[1] if !defined $_[0]; - return $_[1] if __HM_DEDUP and List::Util::first { $_ eq $_[0] } @{$_[1]}; + return $_[1] if __HM_DEDUP and grep { $_ eq $_[0] } @{$_[1]}; return [$_[0], @{$_[1]}] }, HASH => sub { @@ -3935,7 +3931,7 @@ sub _merge_joinpref_attr { ARRAY => { SCALAR => sub { return $_[0] if !defined $_[1]; - return $_[0] if __HM_DEDUP and List::Util::first { $_ eq $_[1] } @{$_[0]}; + return $_[0] if __HM_DEDUP and grep { $_ eq $_[1] } @{$_[0]}; return [@{$_[0]}, $_[1]] }, ARRAY => sub { @@ -3948,7 +3944,7 @@ sub _merge_joinpref_attr { HASH => sub { return [ $_[1] ] if ! @{$_[0]}; return $_[0] if !keys %{$_[1]}; - return $_[0] if __HM_DEDUP and List::Util::first { $_ eq $_[1] } @{$_[0]}; + return $_[0] if __HM_DEDUP and grep { $_ eq $_[1] } @{$_[0]}; return [ @{$_[0]}, $_[1] ]; }, }, @@ -3963,7 +3959,7 @@ sub _merge_joinpref_attr { return [] if !keys %{$_[0]} and !@{$_[1]}; return [ $_[0] ] if !@{$_[1]}; return $_[1] if !keys %{$_[0]}; - return $_[1] if __HM_DEDUP and List::Util::first { $_ eq $_[0] } @{$_[1]}; + return $_[1] if __HM_DEDUP and grep { $_ eq $_[0] } @{$_[1]}; return [ $_[0], @{$_[1]} ]; }, HASH => sub { diff --git a/lib/DBIx/Class/ResultSetColumn.pm b/lib/DBIx/Class/ResultSetColumn.pm index e26b6c2..8d9d7a3 100644 --- a/lib/DBIx/Class/ResultSetColumn.pm +++ b/lib/DBIx/Class/ResultSetColumn.pm @@ -8,9 +8,6 @@ use DBIx::Class::Carp; use DBIx::Class::_Util 'fail_on_internal_wantarray'; use namespace::clean; -# not importing first() as it will clash with our own method -use List::Util (); - =head1 NAME DBIx::Class::ResultSetColumn - helpful methods for messing @@ -56,7 +53,7 @@ sub new { # (to create a new column definition on-the-fly). my $as_list = $orig_attrs->{as} || []; my $select_list = $orig_attrs->{select} || []; - my $as_index = List::Util::first { ($as_list->[$_] || "") eq $column } 0..$#$as_list; + my ($as_index) = grep { ($as_list->[$_] || "") eq $column } 0..$#$as_list; my $select = defined $as_index ? $select_list->[$as_index] : $column; my $colmap; diff --git a/lib/DBIx/Class/ResultSource/RowParser.pm b/lib/DBIx/Class/ResultSource/RowParser.pm index 12e309b..9d41e01 100644 --- a/lib/DBIx/Class/ResultSource/RowParser.pm +++ b/lib/DBIx/Class/ResultSource/RowParser.pm @@ -7,7 +7,7 @@ use warnings; use base 'DBIx::Class'; use Try::Tiny; -use List::Util qw(first max); +use List::Util 'max'; use DBIx::Class::ResultSource::RowParser::Util qw( assemble_simple_parser @@ -452,7 +452,7 @@ sub _resolve_collapse { # if there is at least one *inner* reverse relationship which is HASH-based (equality only) # we can safely assume that the child can not exist without us - rev_rel_is_optional => ( first + rev_rel_is_optional => ( grep { ref $_->{cond} eq 'HASH' and ($_->{attrs}{join_type}||'') !~ /^left/i } values %{ $self->reverse_relationship_info($rel) }, ) ? 0 : 1, diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index daf5885..c8b57b6 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -6,7 +6,6 @@ use warnings; use base qw/DBIx::Class/; use Scalar::Util 'blessed'; -use List::Util 'first'; use DBIx::Class::_Util 'dbic_internal_try'; use DBIx::Class::Carp; use SQL::Abstract qw( is_literal_value is_plain_value ); @@ -1026,7 +1025,10 @@ sub _eq_column_values { # value tracked between column changes and commitment to storage sub _track_storage_value { my ($self, $col) = @_; - return defined first { $col eq $_ } ($self->result_source->primary_columns); + return scalar grep + { $col eq $_ } + $self->result_source->primary_columns + ; } =head2 set_columns diff --git a/lib/DBIx/Class/SQLMaker/LimitDialects.pm b/lib/DBIx/Class/SQLMaker/LimitDialects.pm index 0cfcd2b..e6132d6 100644 --- a/lib/DBIx/Class/SQLMaker/LimitDialects.pm +++ b/lib/DBIx/Class/SQLMaker/LimitDialects.pm @@ -3,9 +3,6 @@ package DBIx::Class::SQLMaker::LimitDialects; use warnings; use strict; -use List::Util 'first'; -use namespace::clean; - # constants are used not only here, but also in comparison tests sub __rows_bindtype () { +{ sqlt_datatype => 'integer' } diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index adcd6b4..71c57da 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -9,7 +9,6 @@ use mro 'c3'; use DBIx::Class::Carp; use Scalar::Util qw/refaddr weaken reftype blessed/; -use List::Util qw/first/; use Context::Preserve 'preserve_context'; use Try::Tiny; use SQL::Abstract qw(is_plain_value is_literal_value); @@ -1743,7 +1742,7 @@ sub _gen_sql_bind { and $op eq 'select' and - first { + grep { length ref $_->[1] and blessed($_->[1]) diff --git a/lib/DBIx/Class/Storage/DBI/ACCESS.pm b/lib/DBIx/Class/Storage/DBI/ACCESS.pm index 7490d89..2e00210 100644 --- a/lib/DBIx/Class/Storage/DBI/ACCESS.pm +++ b/lib/DBIx/Class/Storage/DBI/ACCESS.pm @@ -6,8 +6,6 @@ use base 'DBIx::Class::Storage::DBI::UniqueIdentifier'; use mro 'c3'; use DBI (); -use List::Util 'first'; -use namespace::clean; __PACKAGE__->sql_limit_dialect ('Top'); __PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::ACCESS'); @@ -66,7 +64,7 @@ sub insert { my $columns_info = $source->columns_info; if (keys %$to_insert == 0) { - my $autoinc_col = first { + my ($autoinc_col) = grep { $columns_info->{$_}{is_auto_increment} } keys %$columns_info; diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index cac1529..ecd292b 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -6,7 +6,6 @@ use warnings; use base 'DBIx::Class::Cursor'; use Scalar::Util qw(refaddr weaken); -use List::Util 'shuffle'; use DBIx::Class::_Util qw( detected_reinvoked_destructor dbic_internal_try ); use namespace::clean; @@ -188,7 +187,7 @@ sub all { and ! $self->{attrs}{order_by} ) - ? shuffle @{$sth->fetchall_arrayref} + ? List::Util::shuffle( @{$sth->fetchall_arrayref} ) : @{$sth->fetchall_arrayref} ; } diff --git a/lib/DBIx/Class/Storage/DBI/DB2.pm b/lib/DBIx/Class/Storage/DBI/DB2.pm index c34e641..2154c45 100644 --- a/lib/DBIx/Class/Storage/DBI/DB2.pm +++ b/lib/DBIx/Class/Storage/DBI/DB2.pm @@ -5,8 +5,6 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; -use Try::Tiny; -use namespace::clean; __PACKAGE__->datetime_parser_type('DateTime::Format::DB2'); __PACKAGE__->sql_quote_char ('"'); diff --git a/lib/DBIx/Class/Storage/DBI/Firebird/Common.pm b/lib/DBIx/Class/Storage/DBI/Firebird/Common.pm index 6e61ca5..3677ec3 100644 --- a/lib/DBIx/Class/Storage/DBI/Firebird/Common.pm +++ b/lib/DBIx/Class/Storage/DBI/Firebird/Common.pm @@ -4,8 +4,6 @@ use strict; use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; -use List::Util 'first'; -use namespace::clean; =head1 NAME @@ -80,7 +78,7 @@ EOF $generator = uc $generator unless $quoted; return $generator - if first { + if grep { $self->sql_maker->quote_char ? ($_ eq $col) : (uc($_) eq uc($col)) } @trig_cols; } diff --git a/lib/DBIx/Class/Storage/DBI/IdentityInsert.pm b/lib/DBIx/Class/Storage/DBI/IdentityInsert.pm index 8485e86..c66508d 100644 --- a/lib/DBIx/Class/Storage/DBI/IdentityInsert.pm +++ b/lib/DBIx/Class/Storage/DBI/IdentityInsert.pm @@ -5,8 +5,6 @@ use warnings; use base 'DBIx::Class::Storage::DBI'; use mro 'c3'; -use namespace::clean; - =head1 NAME DBIx::Class::Storage::DBI::IdentityInsert - Storage Component for Sybase ASE and diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index aed3689..f07adfd 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -11,7 +11,6 @@ use mro 'c3'; use Try::Tiny; use DBIx::Class::_Util qw( dbic_internal_try sigwarn_silencer ); -use List::Util 'first'; use namespace::clean; __PACKAGE__->mk_group_accessors(simple => qw/ diff --git a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm index 2ca9939..495b3c8 100644 --- a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm @@ -7,9 +7,6 @@ use base 'DBIx::Class::Storage::DBI'; use mro 'c3'; use DBIx::Class::SQLMaker::LimitDialects; -use List::Util qw/first/; - -use namespace::clean; =head1 NAME diff --git a/lib/DBIx/Class/Storage/DBI/Oracle.pm b/lib/DBIx/Class/Storage/DBI/Oracle.pm index 6dd8b72..a096108 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle.pm @@ -5,8 +5,6 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; use mro 'c3'; -use Try::Tiny; -use namespace::clean; sub _rebless { my ($self) = @_; diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 30a9f54..b196b80 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -7,7 +7,6 @@ use mro 'c3'; use DBIx::Class::Carp; use Scope::Guard (); use Context::Preserve 'preserve_context'; -use List::Util 'first'; use DBIx::Class::_Util qw( modver_gt_or_eq_and_lt dbic_internal_try ); use namespace::clean; @@ -286,7 +285,7 @@ sub _dbh_execute { my ($self, $sql, $bind) = @_[0,2,3]; # Turn off sth caching for multi-part LOBs. See _prep_for_execute below - local $self->{disable_sth_caching} = 1 if first { + local $self->{disable_sth_caching} = 1 if grep { ($_->[0]{_ora_lob_autosplit_part}||0) > (__cache_queries_with_max_lob_parts - 1) diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm index 7c82d28..ed66b28 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm @@ -2,7 +2,6 @@ package DBIx::Class::Storage::DBI::Replicated::Pool; use Moose; use DBIx::Class::Storage::DBI::Replicated::Replicant; -use List::Util 'sum'; use Scalar::Util 'reftype'; use DBI (); use MooseX::Types::Moose qw/Num Int ClassName HashRef/; @@ -323,10 +322,10 @@ is actually connected, try not to hit this 10 times a second. =cut sub connected_replicants { - my $self = shift @_; - return sum( map { - $_->connected ? 1:0 - } $self->all_replicants ); + return scalar grep + { $_->connected } + shift->all_replicants + ; } =head2 active_replicants diff --git a/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm b/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm index 3d054bb..57687ad 100644 --- a/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm +++ b/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm @@ -4,7 +4,6 @@ use strict; use warnings; use base qw/DBIx::Class::Storage::DBI::UniqueIdentifier/; use mro 'c3'; -use List::Util 'first'; use DBIx::Class::_Util 'dbic_internal_try'; use Try::Tiny; use namespace::clean; @@ -50,8 +49,8 @@ sub _prefetch_autovalues { my $values = $self->next::method(@_); - my $identity_col = - first { $colinfo->{$_}{is_auto_increment} } keys %$colinfo; + my ($identity_col) = + grep { $colinfo->{$_}{is_auto_increment} } keys %$colinfo; # user might have an identity PK without is_auto_increment # diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm index 3d66fa1..204ce12 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE.pm @@ -11,7 +11,6 @@ use base qw/ use mro 'c3'; use DBIx::Class::Carp; use Scalar::Util qw/blessed weaken/; -use List::Util 'first'; use Sub::Name(); use Try::Tiny; use Context::Preserve 'preserve_context'; @@ -447,10 +446,10 @@ sub update { if (keys %$fields) { # Now set the identity update flags for the actual update - local $self->{_autoinc_supplied_for_op} = (first + local $self->{_autoinc_supplied_for_op} = grep { $_->{is_auto_increment} } values %{ $source->columns_info([ keys %$fields ]) } - ) ? 1 : 0; + ; my $next = $self->next::can; my $args = \@_; @@ -465,10 +464,10 @@ sub update { } else { # Set the identity update flags for the actual update - local $self->{_autoinc_supplied_for_op} = (first + local $self->{_autoinc_supplied_for_op} = grep { $_->{is_auto_increment} } values %{ $source->columns_info([ keys %$fields ]) } - ) ? 1 : 0; + ; return $self->next::method(@_); } @@ -480,17 +479,14 @@ sub _insert_bulk { my $columns_info = $source->columns_info; - my $identity_col = - first { $columns_info->{$_}{is_auto_increment} } + my ($identity_col) = + grep { $columns_info->{$_}{is_auto_increment} } keys %$columns_info; # FIXME - this is duplication from DBI.pm. When refactored towards # the LobWriter this can be folded back where it belongs. - local $self->{_autoinc_supplied_for_op} = - (first { $_ eq $identity_col } @$cols) - ? 1 - : 0 - ; + local $self->{_autoinc_supplied_for_op} + = grep { $_ eq $identity_col } @$cols; my $use_bulk_api = $self->_bulk_storage && @@ -553,7 +549,7 @@ sub _insert_bulk { my @source_columns = $source->columns; # bcp identity index is 1-based - my $identity_idx = first { $source_columns[$_] eq $identity_col } (0..$#source_columns); + my ($identity_idx) = grep { $source_columns[$_] eq $identity_col } (0..$#source_columns); $identity_idx = defined $identity_idx ? $identity_idx + 1 : 0; my @new_data; diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/ASE/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/Sybase/ASE/NoBindVars.pm index ffd72c4..3ee6cdb 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/ASE/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/ASE/NoBindVars.pm @@ -8,7 +8,6 @@ use base qw/ DBIx::Class::Storage::DBI::Sybase::ASE /; use mro 'c3'; -use List::Util 'first'; use Scalar::Util 'looks_like_number'; use namespace::clean; @@ -42,7 +41,7 @@ sub interpolate_unquoted { return $self->next::method(@_) if not defined $value or not defined $type; - if (my $key = first { $type =~ /$_/i } keys %noquote) { + if (my ($key) = grep { $type =~ /$_/i } keys %noquote) { return 1 if $noquote{$key}->($value); } elsif ($self->is_datatype_numeric($type) && $number->($value)) { diff --git a/lib/DBIx/Class/Storage/DBI/mysql.pm b/lib/DBIx/Class/Storage/DBI/mysql.pm index 1e76d6b..7d0ad04 100644 --- a/lib/DBIx/Class/Storage/DBI/mysql.pm +++ b/lib/DBIx/Class/Storage/DBI/mysql.pm @@ -5,8 +5,6 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; -use namespace::clean; - __PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::MySQL'); __PACKAGE__->sql_limit_dialect ('LimitXY'); __PACKAGE__->sql_quote_char ('`'); diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index e98bc49..305e768 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -28,7 +28,6 @@ use warnings; use base 'DBIx::Class::Storage'; use mro 'c3'; -use List::Util 'first'; use Scalar::Util 'blessed'; use DBIx::Class::_Util qw(UNRESOLVABLE_CONDITION serialize dump_value); use SQL::Abstract qw(is_plain_value is_literal_value); @@ -344,7 +343,7 @@ sub _adjust_select_args_for_complex_prefetch { ) { push @outer_from, $j } - elsif (first { $_->{$alias} } @outer_nonselecting_chains ) { + elsif (grep { $_->{$alias} } @outer_nonselecting_chains ) { push @outer_from, $j; $may_need_outer_group_by ||= $outer_aliastypes->{multiplying}{$alias} ? 1 : 0; } diff --git a/lib/DBIx/Class/_Util.pm b/lib/DBIx/Class/_Util.pm index 09fdfe9..4ff698d 100644 --- a/lib/DBIx/Class/_Util.pm +++ b/lib/DBIx/Class/_Util.pm @@ -80,7 +80,6 @@ use B (); use Carp 'croak'; use Storable 'nfreeze'; use Scalar::Util qw(weaken blessed reftype refaddr); -use List::Util qw(first); use Sub::Quote qw(qsub quote_sub); # Already correctly prototyped: perlbrew exec perl -MStorable -e 'warn prototype \&Storable::dclone' diff --git a/maint/travis-ci_scripts/30_before_script.bash b/maint/travis-ci_scripts/30_before_script.bash index 3965bca..eb65015 100755 --- a/maint/travis-ci_scripts/30_before_script.bash +++ b/maint/travis-ci_scripts/30_before_script.bash @@ -54,7 +54,6 @@ if [[ "$BREAK_CC" == "true" ]] ; then [[ "$CLEANTEST" != "true" ]] && echo_err "Breaking the compiler without CLEANTEST makes no sense" && exit 1 # FIXME - working around RT#74707, https://metacpan.org/source/DOY/Package-Stash-0.37/Makefile.PL#L112-122 - # List::Util can be excised after that as well (need to make my own max() routine for older perls) # # DEVREL_DEPS means our installer is cpanm, which will respect failures # and the like, so stuff soft-failing (failed deps that are not in fact @@ -63,7 +62,6 @@ if [[ "$BREAK_CC" == "true" ]] ; then # FIXME - the PathTools 3.47 is to work around https://rt.cpan.org/Ticket/Display.html?id=107392 # installdeps Sub::Name Clone Package::Stash::XS \ - $( perl -MList::Util\ 1.16 -e1 &>/dev/null || echo "List::Util" ) \ $( [[ "$DEVREL_DEPS" == "true" ]] && ( perl -MFile::Spec\ 3.13 -e1 &>/dev/null || echo "S/SM/SMUELLER/PathTools-3.47.tar.gz" ) ) \ $( perl -MDBI -e1 &>/dev/null || echo "DBI" ) \ $( perl -MDBD::SQLite -e1 &>/dev/null || echo "DBD::SQLite" ) diff --git a/xt/dist/pod_coverage.t b/xt/dist/pod_coverage.t index 97d4975..a86c4d8 100644 --- a/xt/dist/pod_coverage.t +++ b/xt/dist/pod_coverage.t @@ -5,7 +5,6 @@ use warnings; use strict; use Test::More; -use List::Util 'first'; use Module::Runtime 'require_module'; use lib 'maint/.Generated_Pod/lib'; use DBICTest; @@ -167,7 +166,7 @@ foreach my $module (@modules) { SKIP: { my ($match) = - first { $module =~ $_ } + grep { $module =~ $_ } (sort { length $b <=> length $a || $b cmp $a } (keys %$ex_lookup) ) ;