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