mjp-perl-ZYsBlwkHGFY@pilcrow.madison.wi.us (via RT) wrote: > Is it just me, or is File::Glob::GLOB_ERROR() inappropriately > returning a global, shared value, rather than a thread-specific > one? No, GLOB_ERROR is actually stored in a thread specific place. What happens is that it's not zero'ed again when the new interpreter for the new thread is cloned. This is considered normal behaviour : the new thread starts where the one who created it left. I don't know if it's possible to register code to be called at interpreter clone time. It so, we could make it reset GLOB_ERROR. > $ cat globbit.pl > use v5.8.1; > use threads; > use File::Glob ':glob'; > use strict; > > sub e($) { > my $g = shift; > my $t = threads->tid; > print "Thread ", threads->tid, "\n"; > print "\tinitial GLOB_ERROR: ", &GLOB_ERROR, "\n"; > bsd_glob($g); > print "\tfinal GLOB_ERROR: ", &GLOB_ERROR, "\n"; > } > > for (qw|/root/eacces* /tmp /*/*/*/*/*/*/*|) { > threads->create(\&e, $_)->join; > } > __END__ > > $ perl globbit.pl > Thread 1 > initial GLOB_ERROR: 0 > final GLOB_ERROR: -2 > Thread 2 > initial GLOB_ERROR: -2 > final GLOB_ERROR: 0 > Thread 3 > initial GLOB_ERROR: 0 > final GLOB_ERROR: -2Thread Previous