in reply to Tie-ing hashes clobbers data
return \%data;this returns a reference to the GLOBAL %FileHash::data that is set by the do $file, so you are using the same hash for all FileHash objects.
The quickest way to solve this is to change the offending line with:
return {%data};
which returns a reference to a COPY of %data, leaving %FileHash::data free to be clobbered by a new do $file
anyway, this will still leave your race conditions intact :-)
Joost.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Referencing globals clobbers data
by demerphq (Chancellor) on Apr 08, 2002 at 15:23 UTC | |
by Joost (Canon) on Apr 08, 2002 at 15:54 UTC | |
by demerphq (Chancellor) on Apr 08, 2002 at 16:24 UTC |