in reply to Re: Iterating over *any* thing in Perl
in thread Iterating over *any* thing in Perl

Data::Dumper does a pretty good job.

No it doesn't. It'll fail on:

package Pet; my (%colour, %name, %species); sub new {bless [] => shift} sub colour : lvalue {$colour {+shift}}; sub name : lvalue {$name {+shift}}; sub species : lvalue {$species {+shift}}; sub DESTROY { my $self = shift; delete $colour {$self}; delete $name {$self}; delete $species {$self}; } 1; __END__

There's no way you can get to the attributes from the outside, other than using the interface. And that's a feature, not a bug.


Replies are listed 'Best First'.
Re: Re: Iterating over *any* thing in Perl
by BrowserUk (Pope) on Dec 03, 2002 at 13:37 UTC

    Agreed. I guess you'd need to use Padwalker to get at those.

    And that's a feature, not a bug

    Also agreed. That's a much better way to implement private data.

    Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
    Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
    Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
    Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.