Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Answer: Class::MethodMaker initialization of default values

by samtregar (Abbot)
on Jul 01, 2002 at 23:58 UTC ( #178733=categorized answer: print w/replies, xml ) Need Help??

Q&A > object-oriented programming > Class::MethodMaker initialization of default values - Answer contributed by samtregar

How about (untested):

package Simple; use Class::MethodMaker get_set => [qw(a b)], new_hash_init => 'hash_init'; sub new { my $pkg = shift; my %args = ( b => "default", @_ ); return $pkg->hash_init(%args); }


Log In?

What's my password?
Create A New User
[hippo]: It may be too far down the tree for some folks to bother with, but IMHO, Re^32: global var is probably node of the day already. (++)
[Lady_Aleena]: Discipulus, print working directory?
[Corion]: "P(ass)w(or)d" ;)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-04-26 08:24 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (471 votes). Check out past polls.