summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2018-03-03 23:50:10 +0100
committerMathieu Lirzin <mthl@gnu.org>2018-03-08 21:33:14 +0100
commit74902aa24d4c313ab51fa684142d9240f636971a (patch)
treef906ad5581f51d5ebf5159643d27ae0594396ac1 /lib
parent9385c161707c6d2295d610eef81fe4d1a44b44de (diff)
downloadautomake-74902aa24d4c313ab51fa684142d9240f636971a.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/Automake/General.pm20
1 files changed, 19 insertions, 1 deletions
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