[Dbix-class] Use of uninitialized value warning in DBIx/Class/ResultSet.pm line 2768 (and others)

Peter Rabbitson rabbit+dbic at rabbit.us
Thu Aug 27 07:37:46 GMT 2009


Daniel Austin wrote:
>> [...]
>> They all pass because none of them have an empty alias. You are
>> certainly doing something very wrong,
> 
> I thought that must be the case. Wouldn't be the first time. :-)
> 
>> most probably when you do
>> the custom sql magic.
> 
> I've backed that out but I still get the errors.
> 
> Here's my setup: I'm using DBIx::Class 0.08109 and Catalyst 5.80007.
> Perl 5.8.8 running on OSX 10.5. Using PostgreSQL 8.3.4 with
> DBIx::Class.
> 
> I have the following files:
> 
> lib/MyCompany/Schema.pm:
>     package MyCompany::Schema;
>     use strict;
>     use warnings;
>     use base 'DBIx::Class::Schema';
>     __PACKAGE__->load_namespaces;
> 
> lib/MyCompany/Schema/Result/Customer.pm:
>     package MyCompany::Schema::Result::Customer;
>     use strict;
>     use warnings;
>     use Carp;
> 
>     use base 'DBIx::Class::ResultSet';
>     use Data::FormValidator::Constraints qw(:closures);
> 
>     __PACKAGE__->load_components(qw/Validation Core/);
>     __PACKAGE__->table("customer");
>     __PACKAGE__->add_columns( ... );
> 
> There's quite a few classes like the above, all following the same
> pattern. I did this since the documentation indicated it was the
> preferred development practice these days...

Stopping you right here - what lives in /Result/* are result classes,
(also known as row classes) not resultset classes. So every Result::*
should use base 'DBIx::Class' not ResultSet. Incidentally stuff in
/ResultSet/* is considered a resultset and every ResultSet::* is
expected to inherit from DBIx::Class::ResultSet.



More information about the DBIx-Class mailing list