Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: declaring accessor methods from a list

by ferreira (Chaplain)
on Apr 27, 2007 at 11:31 UTC ( #612352=note: print w/replies, xml ) Need Help??


in reply to declaring accessor methods from a list

As AK108 pointed out, Class::Accessor is a nice module to do what you want and like it a lot as well. With it, your code would turn to be:
package Bro::Doug ; use strict ; use warnings ; use base qw(Class::Accessor); __PACKAGE__->mk_ro_accessors( qw(one two three) ); 1;
and you will get the accessors and the new constructor for free.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-10-29 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (266 votes). Check out past polls.

    Notices?