laziness, impatience, and hubris | |
PerlMonks |
Moose: checking parms in object constructionby Marshall (Canon) |
on Aug 02, 2017 at 03:49 UTC ( [id://1196502]=perlquestion: print w/replies, xml ) | Need Help?? |
Marshall has asked for the wisdom of the Perl Monks concerning the following question:
I am a complete newbie to Moose. I would appreciate some help with what a I hope is a "simple" Moose problem. The code below "works". But I want to enhance it so that the new() method for Appointment will throw an exception or otherwise report an error if the parameters don't "jive" when taken into context amoungst each other. In addition, is there any easy way to say limit the Month parameter to between 1 and 12? I can see that 'Int' works, but is it possibile to be more specific in the limitation? FILE:test.pl FILE: Appointment.pm Update: I have found the replies by kevbot++ and Your Mother++ to be extremely helpful. Thanks!
Back to
Seekers of Perl Wisdom
|
|