good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Perl Object Initilizationby PyrexKidd (Monk) |
on Jun 09, 2011 at 19:34 UTC ( [id://908988]=note: print w/replies, xml ) | Need Help?? |
Ah, HA! So I have to dereference $self to a hash then I can treat it as a hash. (DUH! right...) I've always heard that it is bad practice to access an objects 'private' variables. I know this concept isn't enforced explicitly in Perl, but is there a good way to do this?
(Granted for some reason this: # my $FHOUT = shift || "STDOUT"; # print $FHOUT $self->{'a'} . "\n"; doesn't work as expected ...) this works but then how do you control output direction? Is there a 'cleaner' way to do this? and finally, how about destroying objects? according to perlobj, objects are destroyed automagically when they go out of scop, but what if I want to destroy them manually? as far as I can tell, calling a method DESTROY does not automatically destroy it... Is there even any reason to cleanup after your objects?
In Section
Seekers of Perl Wisdom
|
|