Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: basic object question

by mfriedman (Monk)
on Jun 15, 2002 at 05:18 UTC ( #174802=note: print w/replies, xml ) Need Help??

in reply to basic object question

Instead of using plain old hashes within your object hash, make your object hash contain other objects. Then, you could write Get and Set methods for those.

That might be a pain, though.

My personal preference is not to make anything beyond the first level of the object hash directly useful to the outside. I'll populate the first level with data members and write accessors and mutators for them. Then I'll do something like:

$self->{_private}{'foo'} = Foo->new;

I then make sure that none of my accessors or mutators will return $self->{_private}. Of course, it's not really private, but it works enough for me.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-06-18 02:53 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (87 votes). Check out past polls.