-use strictures 1;
-use Test::More;
use Config;
BEGIN {
- unless ($Config{useithreads} && eval { require threads } ) {
- plan skip_all => "your perl does not support ithreads";
+ unless ($Config{useithreads}) {
+ print "1..0 # SKIP your perl does not support ithreads\n";
+ exit 0;
}
}
+use threads;
+use strictures 1;
+use Test::More;
use Sub::Defer;
$made{'Foo::one'} = sub { 'one' }
};
-ok(threads->create(sub {
+is(threads->create(sub {
my $info = Sub::Defer::defer_info($one_defer);
- $info && $info->[0] eq 'Foo::one';
-})->join, 'able to retrieve info in thread');
+ $info && $info->[0];
+})->join, 'Foo::one', 'able to retrieve info in thread');
-ok(threads->create(sub {
+is(threads->create(sub {
undefer_sub($one_defer);
- $made{'Foo::one'} && $made{'Foo::one'} == \&Foo::one;
-})->join, 'able to undefer in thread');
+ $made{'Foo::one'} && $made{'Foo::one'} == \&Foo::one && 1234;
+})->join, 1234, 'able to undefer in thread');
done_testing;
-use strictures 1;
-use Test::More;
use Config;
BEGIN {
- unless ($Config{useithreads} && eval { require threads } ) {
- plan skip_all => "your perl does not support ithreads";
+ unless ($Config{useithreads}) {
+ print "1..0 # SKIP your perl does not support ithreads\n";
+ exit 0;
}
}
+use threads;
+use strictures 1;
+use Test::More;
use Sub::Quote;
3 + $x++
} => { '$x' => \do { my $x = 0 } };
-ok(threads->create(sub {
+is(threads->create(sub {
my $quoted = quoted_from_sub($one);
- $quoted && $quoted->[1] eq $one_code;
-})->join, 'able to retrieve quoted sub in thread');
+ $quoted && $quoted->[1];
+})->join, $one_code, 'able to retrieve quoted sub in thread');
my $u_one = unquote_sub $one;