in reply to Tie-ing hashes clobbers data
But I think the heart of your problem is here:
and hereprint FH Data::Dumper->Dump([\%data], ['*data']);
This line sets the $ret value to be equal to the glob *data which was just overwritten by you. (ok, so you ignore the $ret and use the global var \%data, but that was just overwritten so... Same dif.) So its the copy semantics in the _write and _read subs that are causing you trouble. Change them to use scalar refs and not globs and the problem will go away. Oh and lose the shallow copy in _read its misleading and unnecessary.my $ret = do $file
UPDATE
A question: Why are you mixing proper method calls and procedural calls? _write() is a method, but you call it as a procedure. This means it wont be overidable in a subclass...
sub DESTROY { _write ($_[0]) } #not overidable!
Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tie-ing hashes clobbers data
by Anonymous Monk on Apr 08, 2002 at 22:36 UTC | |
by demerphq (Chancellor) on Apr 09, 2002 at 08:04 UTC | |
by Anonymous Monk on Apr 09, 2002 at 13:38 UTC | |
by Anonymous Monk on Apr 09, 2002 at 22:38 UTC | |
| |
by demerphq (Chancellor) on Apr 09, 2002 at 17:01 UTC | |
by Anonymous Monk on Apr 09, 2002 at 21:37 UTC | |
|