in reply to Given a tie object, get a tied hash (or scalar, or whatever)

Why do you have to use $obj in the call to Foo()? Shouldn't you simply use the %hash value to create %newhash?
The basic problem that I see is that $obj doesn't know anything about the class %hash was tied to, so there is no simple way to implement Foo($obj).
  • Comment on Re: Given a tie object, get a tied hash (or scalar, or whatever)

Replies are listed 'Best First'.
Re: Re: Given a tie object, get a tied hash (or scalar, or whatever)
by Dice (Beadle) on Aug 13, 2003 at 16:50 UTC
    > The basic problem that I see is that $obj doesn't know anything about the class %hash was tied to

    No? What would ref($obj) return? Remember that $obj comes from

    my $obj = tied(%hash);

    And the very def'n of tied is that it returns the underlying object that implements the tied thingy.

    Cheers,
    Richard