Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Iterating over *any* thing in Perl

by Abigail-II (Bishop)
on Dec 03, 2002 at 11:47 UTC ( #217180=note: print w/replies, xml ) Need Help??


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

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://217180]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2021-05-06 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (79 votes). Check out past polls.

    Notices?