Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
go ahead... be a heretic
 
PerlMonks  

Re: Writing constructors

by perlfan (Parson)
on Feb 25, 2005 at 12:02 UTC ( [id://434568]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Writing constructors

I tend to use:
sub new { my $class = shift; bless { _att1 => $_[0], ... _attN => undef, }, $class; }
I like to initialize a member attribute field in the blessed hash, even if it is not neccessarily defined during construction. I also like to minimize the number of input parameters in my constructors, but that really is just a personal preference.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://434568]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.