From 74902aa24d4c313ab51fa684142d9240f636971a Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sat, 3 Mar 2018 23:50:10 +0100 Subject: automake: Don't rely on List::Util to provide 'none' This change fixes automake bug#30631. This removes the use of List::Util which is not supported by Perl 5.6, by reimplementing the 'none' subroutine. * lib/Automake/General.pm (none): New subroutine. * bin/automake.in (handle_single_transform): Use it. * t/pm/General.pl: New test. * t/list-of-tests.mk (perl_TESTS): Add it. * NEWS: Update. --- lib/Automake/General.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Automake/General.pm b/lib/Automake/General.pm index 32f5c8db7..aa2de38b8 100644 --- a/lib/Automake/General.pm +++ b/lib/Automake/General.pm @@ -23,7 +23,7 @@ use File::Basename; use vars qw (@ISA @EXPORT); @ISA = qw (Exporter); -@EXPORT = qw (&uniq $me); +@EXPORT = qw (&uniq &none $me); # Variable we share with the main package. Be sure to have a single # copy of them: using 'my' together with multiple inclusion of this @@ -66,5 +66,23 @@ sub uniq (@) return wantarray ? @res : "@res"; } +# $RES +# none (&PRED, @LIST) +# ------------ +# Return 1 when no element in LIST satisfies predicate PRED otherwise 0. +sub none (&@) +{ + my ($pred, @list) = @_; + my $res = 1; + foreach my $item (@list) + { + if ($pred->($item)) + { + $res = 0; + last; + } + } + return $res; +} 1; # for require -- cgit v1.2.1