[Chicago-talk] Class::Accessor uses a hashref - a question of style

Jay Strauss me at heyjay.com
Sun Jan 25 12:51:06 CST 2004


I use Class::Accessor.  When you create a new obj you call it with a

my $obj = Class->new({ foo => 42 });

I prefer doing:

my $obj = Class->new(foo => 42);

It's easy to override Class::Accessor to make it do what I want, by adding:

sub new {
    my $class = shift;

to my class.

Now the question:  Is it just a personal preference to use a hash or a
hashref when creating a class.  Or is one one syntax preferred by those
people who make the rules?


More information about the Chicago-talk mailing list