On Sat, Sep 01, 2001 at 02:26:36PM -0400, Bryan C. Warnock wrote: > > Because, you have the weird caveat of having to keep the returned > > variable around. > > > > use File::chdir; > > > > { > > my $old_dir = chdir($dir); > > } > > > > The wires are showing through the magician's trick. > > Wouldn't that be: > > use File::chdir; > > { > local $cwd = $dir; # Assuming $cwd FETCH and STORE manipulated chdir > } I didn't want to introduce a completely different way to change the directory. But let's say I did. How does a tied variable know it's been localized? $CWD = "bar"; { local $CWD = "foo"; } seems to trigger... $tied_obj->STORE("bar"); for the first assignment. $tied_obj->FETCH $tied_obj->STORE $tied_obj->STORE("foo"); from the local and $tied_obj->STORE(1) when it falls out of scope. It *looks* like it's trying to reset the original value via that last STORE, but screwing it up. > Also, one comment on your patch - I saw a doc change for chdir, but I didn't > see one for local. There's one in there. -- Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/ Perl6 Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One Some like elmers glue but it needs reapplying. I use super glue. -- tlkThread Previous | Thread Next