Bizarre error: Can't fetch data as class method

3 messages Options
Embed this post
Permalink
Dan Horne

Bizarre error: Can't fetch data as class method

Reply Threaded More More options
Print post
Permalink
Hi all

This morning I generated my schema using DBIX::Schema::Loader and  
spent the best part of a day trying to debug the following message;

DBIx::Class::Row::get_column(): Can't fetch data as class method at  
(eval 74) line 6

After much faffing around, I managed to zero in on the error. i had  
the following definition in a class:

   "source_name",
   {
     data_type => "VARCHAR2",
     default_value => undef,
     is_nullable => 0,
     size => 50,
   },

It seems there must be some collision between the column name and  
something in DBIC. So, how can I progress if I can't change the column  
name in the underlying table?



_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
peter-8

Re: Bizarre error: Can't fetch data as class method

Reply Threaded More More options
Print post
Permalink

DBIx::Class::Row::get_column(): Can't fetch data as class method at (eval 74) line 6

After much faffing around, I managed to zero in on the error. i had the following definition in a class:

 "source_name",
 {
   data_type => "VARCHAR2",
   default_value => undef,
   is_nullable => 0,
   size => 50,
 },


Have you got a sample piece of your calling code that was giving the error?

Regards, Peter


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Peter Rabbitson-2

Re: Bizarre error: Can't fetch data as class method

Reply Threaded More More options
Print post
Permalink
In reply to this post by Dan Horne
On Tue, Jul 07, 2009 at 06:02:02PM +1200, Dan Horne wrote:

> Hi all
>
> This morning I generated my schema using DBIX::Schema::Loader and spent
> the best part of a day trying to debug the following message;
>
> DBIx::Class::Row::get_column(): Can't fetch data as class method at  
> (eval 74) line 6
>
> After much faffing around, I managed to zero in on the error. i had the
> following definition in a class:
>
>   "source_name",
>   {
>     data_type => "VARCHAR2",
>     default_value => undef,
>     is_nullable => 0,
>     size => 50,
>   },
>
> It seems there must be some collision between the column name and  
> something in DBIC. So, how can I progress if I can't change the column  
> name in the underlying table?
>

You diagnosed everything correctly, this is an unfortunate clash. Look at
the POD for DBIC::ResultSource::add_columns(), especially the 'accessor'
attribute.

Cheers

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...