Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Answer: Class::MethodMaker initialization of default values

( #178733=categorized answer: print w/ replies, xml ) Need Help??

Q&A > object-oriented programming > Class::MethodMaker initialization of default values 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); }

-sam

Comment on Answer: Class::MethodMaker initialization of default values
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-12-29 08:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls