[Catalyst] Issues with Catalyst::Model::DBIC::Schema and overload

Matt S Trout dbix-class at trout.me.uk
Wed Mar 8 18:57:42 CET 2006


Bernhard Graf wrote:
> Hi,
> 
> I just wrote my first piece of Catalyst code that uses DBIx::Class and 
> Catalyst::Model::DBIC::Schema.
> 
> First tried to find() something from a table.
> While this works fine with a plain DBIx::Class application, it fails 
> when doing the same under Catalyst. I get:
> 
> Caught exception in My::Controller::User->find "Can't resolve method 
> `???' overloading `""' in package `My::Model::DB::User' 
> at /usr/lib/perl5/vendor_perl/5.8.5/Catalyst.pm line 1015."
> 
> My Table Class
> 
> My::Schema::User;
> use base 'DBIx::Class';
> use overload '""' => 'stringify';
> [...]
> sub stringify { shift->name }
> 
> There is a simple fix:
> As soon as I remove the overload from the table class everything works.
> 
> But I like my overload ...
> 
> Can you help me?

use overload
   '""' => sub { shift->name },
   fallback => 1;

?

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list