Hash or List to constructors

Scott Penrose scottp at dd.com.au
Sun Jun 30 17:59:21 CDT 2002

Hi Dudes,

I was wondering people opinion on constructors.

I have a new module I am writing which currently requires two inputs 
(device, strobe). The first being a scalar and the second a number. I 
thought also that I may in the future have an optional 3rd parameter 
which is the timeout between the strobe.

I am wondering if it is better to go for a hash

	->new(device => 'somedevice', strobe => 15, interval => 150, ...)

of is it better to extend the list of values?

My preference for simple constructors (eg: DBI) is to hand just one 
parameter. But for complex entries (eg: DBI options) it is best to use a 
hash, or even a hash ref.

Preferences, feedback ?

Scott Penrose
Welcome to the Digital Dimension
scottp at dd.com.au

Dismaimer: Contents of this mail and signature are bound to change 
randomly. Whilst every attempt has been made to control said randomness, 
the author wishes to remain blameless for the number of eggs that damn 
chicken laid. Oh and I don't want to hear about butterflies either.

More information about the Melbourne-pm mailing list