Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
To answer your initial question -- that depends on what you are trying to solve. :) You need to be more specific to get a answer with more value than that. You need to think in terms of readability, maintainabilty, correctness, robustness, etc. Here is a constructor i like use when the situation is quick and dirty That's all you need -- you can add attributes later. However, if i am writing production code, i might opt for the more verbose version:
I try to use Class::MethodMaker whenever i can, i just like that module. Here is an example where i use that module to turn XML into real objects: XML::Simple + Class::MethodMaker. Hope this helps. :) jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat) In reply to Re: Object Constructors - Advice of experienced OO Perl Monks
by jeffa
|
|