Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Moo different parameters for constructor

by tobyink (Canon)
on May 17, 2019 at 14:00 UTC ( [id://11100174]=note: print w/replies, xml ) Need Help??


in reply to Moo different parameters for constructor

As others have suggested, BUILDARGS will do the job. Personally, I think you should consider:

1. my $date = MyDate->now; 2. my $date = MyDate->new(year => $y, month => $m, day => $d); 3. my $date = MyDate->parse("$y$m$d");

There's no reason to force them all to happen through the same constructor method. #1 and #3 would just be wrappers for #2.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2024-04-18 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found