Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Object methods from hashy structures

by stvn (Monsignor)
on Dec 24, 2007 at 22:22 UTC ( [id://658933]=note: print w/replies, xml ) Need Help??


in reply to Re: Object methods from hashy structures
in thread Object methods from hashy structures

Moose actually has a built in feature/shortcut for this.

package Foo; use Moose; has [qw( name age sex job )] => ( is => 'rw' );
This will create 4 attributes (name, age, sex, job) in your Foo class, all of which have the same options (is => 'rw').

-stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://658933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-16 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found