BEGIN { # Magic Perl CORE pragma
if ($ENV{PERL_CORE}) {
chdir 't' if -d 't';
@INC = '../lib';
}
}
use Test::More tests => 2 + (3 * 4 );
use strict;
use threads;
our $count : shared;
package => 'Without',
package => 'WithCloneCoderef',
fixup => sub { $count++ },
package => 'WithCloneName',
fixup => 'fixup',
package => 'WithCloneFQName',
fixup => 'WithCloneFQName::fixup',
;
$count = 0;
eval { Without->new };
ok (!$@, "Object going out of scope: $@" );
is( $count,0,"Check # of fixups of Without" );
foreach (qw(WithCloneCoderef WithCloneName WithCloneFQName)) {
$count = 0;
eval { $_->new };
ok (!$@, "Execution ok: $@" );
is( $count,0,"Check # of fixups of $_" );
$count = 0;
eval {
my $object = $_->new;
threads->new( sub {1} )->join foreach 1..5;
};
ok (!$@, "Execution ok: $@" );
is( $count,5,"Check # of fixups of $_, with threads" );
}
package Without;
sub new { bless [],shift }
sub new { bless {},shift }
package WithCloneName;
sub new { bless {},shift }
sub fixup { $count++ }
sub new { bless {},shift }
sub fixup { $count++ }