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

Peter Rabbitson rabbit+dbic at rabbit.us
Tue Aug 25 07:40:10 GMT 2009


Daniel Austin wrote:
> [Woops. Sent this to the old list address. Take 2...]
> 
> Hi
> 
> I recently switched my DBIx::Class modules to using Result Sets. So I
> have a MyCompany/Schema/Result directory with a bunch of modules that
> inherit from DBIx::Class::ResultSet.
> 
> Apart from a few minor issues the regression tests all pass now except
> I've started getting thousands of warnings like this:
> 
>     Use of uninitialized value in concatenation (.) or string at
> ./lib/perl5/DBIx/Class/ResultSet.pm line 2768.
> 
> The variable in question is $alias which comes out of
> $self->{attrs}->{alias}.
> 
> Changing line 2761 to this:
> 
>       my $alias  = $attrs->{alias} || '';
> 
> suppresses the warning but not sure if it's correct (all the
> DBIx::Class tests seem to still pass).

They all pass because none of them have an empty alias. You are
certainly doing something very wrong, most probably when you do
the custom sql magic. Show relevant pieces of code, and also
tell us what version of DBIC are you running. Especially important
is the call which triggers the warning - what does it look like?


> The first few lines of my classes all look like this:
> 
>    package MyCompany::Schema::Result::Centre;
>    use strict;
>    use warnings;
>    use base 'DBIx::Class::ResultSet';
>    __PACKAGE__->load_components("Core");
>    __PACKAGE__->table("centre");
>    __PACKAGE__->add_columns( ... );
> 
> (I was trying to follow the example in the Catalyst tutorial. I needed
> to do it this way in order  to use some custom SQL)
> 
> Am I doing something wrong in setting up these classes? Or should I
> work on a patch that takes care of the case where attrs->alias is not
> defined?
> 
> Thanks
> 
> Dan
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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@lists.scsys.co.uk




More information about the DBIx-Class mailing list