Subject: | Build and test failed with Perl 5.21.11 |
The build of threads-lite failed with a following error:
+ ./Build
Building threads-lite
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/ \$ { <-- HERE (\w+) } / at src/tables.h.PL line 231.
src/tables.h.PL failed at /usr/share/perl5/vendor_perl/Module/Build/Base.pm line 2930.
When I fix the regex I found that tests failed.
+ ./Build test
# Testing threads::lite 0.033, Perl 5.021011, /usr/bin/perl
t/00-load.t ....... ok
Thread 1 got error Undefined subroutine &main::sleep called at (eval 4) line 6.
# Failed test '$_ is "something else"'
# at t/10-basics.t line 55.
# got: 'exit'
# expected: 'something else'
t/10-basics.t .....
Failed 5/6 subtests
The attachment contains possible solution.
Subject: | Fix-regex-and-test.patch |
diff -up threads-lite-0.033/src/tables.h.PL.orig threads-lite-0.033/src/tables.h.PL
--- threads-lite-0.033/src/tables.h.PL.orig 2015-05-05 10:52:26.659277898 +0200
+++ threads-lite-0.033/src/tables.h.PL 2015-05-05 10:52:46.222506532 +0200
@@ -228,6 +228,6 @@ STATIC void S_${name}_db_free(pTHX_ ${na
#define ${name}_db_free(t) S_${name}_db_free(aTHX_ t)
END
- $entry =~ s/ \$ { (\w+) } /$replacements{$1}/gxe;
+ $entry =~ s/ \$ \{ (\w+) \} /$replacements{$1}/gxe;
print $entry;
}
diff -up threads-lite-0.033/t/10-basics.t.orig threads-lite-0.033/t/10-basics.t
--- threads-lite-0.033/t/10-basics.t.orig 2015-05-05 14:21:23.752796837 +0200
+++ threads-lite-0.033/t/10-basics.t 2015-05-05 14:22:01.727260997 +0200
@@ -6,17 +6,16 @@ use experimental 'smartmatch';
use Test::More tests => 6;
use Test::Differences;
-use Time::HiRes qw/sleep/;
use threads::lite qw/spawn receive self/;
-my $thread = spawn({ modules => ['Carp'], monitor => 1 }, \&thread );
+my $thread = spawn({ modules => ['Carp', 'Time::HiRes'], monitor => 1 }, \&thread );
$thread->send(self());
sub thread {
my $other = threads::lite::receiveq;
- sleep .1;
+ Time::HiRes::sleep(.1);
$other->send('foo');
$other->send('bar');
$other->send('something else');