in reply to Tie::IxHash weird metadata?

It looks like you're using the return value from tie. You don't need to do that, Tie::IxHash modifies the behaviour of the underlying hash (or at least it appears to you program that it does) so you don't need the tied object at all. This snippet illustrates the difference.

use Tie::IxHash; use Data::Dumper; my %data; my $ref = \%data; my $tied_obj = tie(%data, 'Tie::IxHash'); $ref->{one} = 1; $ref->{two} = 2; $ref->{three} = 3; $ref->{four} = 4; print Dumper $ref; print Dumper $tied_obj;

The first print Dumps what you want. The second Dumps what you're getting.

It's usually safe to ignore the return value from tie.

Replies are listed 'Best First'.
Re: Tie::IxHash weird metadata?
by Kjetil (Sexton) on Mar 29, 2003 at 20:35 UTC
    Aha, now something dawned on me. Thanks a lot!

    I can't just ignore the return value, because I have to Push something on it later, but I can of course work on a different variable. When I do that, it gets through XML::Simple beautifully indeed! :-) Jihaa!

    However, I get a new problem, all this happens in a recursive sub, to go through the response tree. But modifying the underlying hash apparently has the side effect of stopping the recursion... :-( So, now I have a different problem to look into...

    Guess I'd just get to work...

      I can't just ignore the return value, because I have to Push something on it later

      If you're just 'push'ing something on, then you still shouldn't need the tied object reference - just assign a value to a key and TieIxHash will still retain the order.