williamcharles has asked for the wisdom of the Perl Monks concerning the following question:
1. MyDate->new(); 2. MyDate->new(year=>2019, month=>05, day=>16); 3. MyData->new(date=>20190516);
1. When called like this, I would like to use the Date::Calc::Today to assign the values to year, month and day
2. When called like this, the values passed will be set to instance data.
3. When called like this, I would want to regex and find year, month and day and assign it to instance data.
I am not sure on how to achieve using Moo. Can anyone help me with the template. Thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moo different parameters for constructor
by haukex (Archbishop) on May 16, 2019 at 11:17 UTC | |
by williamcharles (Novice) on May 16, 2019 at 15:27 UTC | |
by haukex (Archbishop) on May 16, 2019 at 15:36 UTC | |
|
Re: Moo different parameters for constructor
by choroba (Cardinal) on May 16, 2019 at 12:52 UTC | |
|
Re: Moo different parameters for constructor
by LanX (Saint) on May 16, 2019 at 11:09 UTC | |
|
Re: Moo different parameters for constructor
by tobyink (Canon) on May 17, 2019 at 14:00 UTC |