justanyone has asked for the wisdom of the Perl Monks concerning the following question:
Hi!!
I'm using Class::MethodMaker to construct a simple class with two vars. I want to initialize one var and leave the second as a defaulted value.
I think this means I need to do this:
How do I default the value of b to something? Class::MethodMaker has somewhat documentation on this, and I'm confused. My wife seems to think I'm not stupid (despite my opinion)... in which case this confusion might be something someone else has encountered...use Class::MethodMaker '-sugar'; package Simple; make methods get_set => [qw(a b)], new_with_init => 'new'; sub init { my ($self, %args) = @_; #... what goes here? } ------ my $simp = new LogSimple(a => 4); print("a=" . $simp->a() . ", b = " $simp->b() . "\n"); ----------
Any hints? The perldoc / module documentation is somewhat limited.
Thanks for any assistance here,
Cordially yours,
-- Kevin J. Rice
http://www.JustAnyone.com or email is kevin at justanyone.com also.
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Class::MethodMaker initialization of default values
by vishi83 (Pilgrim) on Oct 22, 2005 at 14:32 UTC | |
Re: Class::MethodMaker initialization of default values
by samtregar (Abbot) on Jul 01, 2002 at 23:58 UTC | |
Re: Class::MethodMaker initialization of default values
by justanyone (Acolyte) on Jul 02, 2002 at 16:54 UTC |
Back to
Seekers of Perl Wisdom