3 unless ($Config{useithreads}) {
4 print "1..0 # SKIP your perl does not support ithreads\n";
14 my $one = quote_sub my $one_code = q{
15 BEGIN { $::EVALED{'one'} = 1 }
19 my $two = quote_sub q{
20 BEGIN { $::EVALED{'two'} = 1 }
22 } => { '$x' => \do { my $x = 0 } };
24 is(threads->create(sub {
25 my $quoted = quoted_from_sub($one);
26 $quoted && $quoted->[1];
27 })->join, $one_code, 'able to retrieve quoted sub in thread');
29 my $u_one = unquote_sub $one;
31 is(threads->create(sub { $one->() })->join, 42, 'One (quoted version)');
33 is(threads->create(sub { $u_one->() })->join, 42, 'One (unquoted version)');
35 my $r = threads->create(sub {
38 push @r, unquote_sub($two)->();
43 is($r->[0], 3, 'Two in thread (quoted version)');
44 is($r->[1], 4, 'Two in thread (unquoted version)');
45 is($r->[2], 5, 'Two in thread (quoted version again)');