http://www.perlmonks.org?node_id=217180


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.

Abigail