1use strict; 2use warnings; 3 4use Test::More; 5use Config; 6 7BEGIN { 8 plan skip_all => 'Perl compiled without ithreads' 9 unless $Config{useithreads}; 10 plan skip_all => 'no threads.pm' 11 unless eval { require threads }; 12 plan tests => 2; 13} 14 15use threads; 16use Digest::MD5; 17 18my $module = 'Digest::MD5'; 19 20my $obj = $module->new; 21$obj->add("foo"); 22my $tdigest = threads->create(sub { $obj->add("bar"); $obj->hexdigest })->join; 23 24isnt $obj->clone->hexdigest, $tdigest, "unshared object unaffected by the thread"; 25 26$obj->add("bar"); 27is $obj->clone->hexdigest, $tdigest; 28