Re: [siesta-dev] Class::Accessor

[prev] [thread] [next] [lurker] [Date index for 2003/04/01]

From: Iain 'Spoon' Truskett
Subject: Re: [siesta-dev] Class::Accessor
Date: 08:31 on 01 Apr 2003
* Simon Wistow (simon@xxxxxxxxxx.xxx) [01 Apr 2003 17:24]:

> Either I'm smoking the lackofsleep crack or there's oddness abounding. 
> I'm voting for the first.

> I'm attempting to migrate to Class::Accessor::Fast but I'm buggered if I 
> can stop it from giving me errors. This code ...

> BEGIN {
>     # the fields that live in storage
>     @fields = qw( id name post_address return_path owner );
> }

> # automaticall make get/set methods
> use base 'Class::Accessor::Fast';
> Siesta::List->mk_accessors(@fields, 'siesta');

[...]
> Set the plugins for dealers to be :
> Can't use string ("name") as a HASH ref while "strict refs" in use at 
> /usr/local/perl5.6.1/lib/site_perl/5.6.1/Class/Accessor.pm line 151.
> not ok 6 - created dealers
> #     Failed test (t/05setup_database.t at line 32)
> #          got: '65280'
> #     expected: '0'
[...]

It looks like you've done what I did yesterday and tried calling
Class::Accessor's new with a hash rather than a hashref.

i.e. $class->new( foo => 4 )
rather than $class->new(  { foo => 4 } );

What I did to fix this was insert a new that looked like:

    sub new { shift->SUPER::new({ @_ }) }

which let me keep the interface.

cheers,
-- 
Iain.

Generated at 13:56 on 01 Jul 2004 by mariachi 0.52