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

Daniel Austin daniel.austin at gmail.com
Thu Aug 27 01:21:15 GMT 2009


> [...]
> 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, but also because one of
these classes has some custom SQL. But I've removed that from the code
at the moment and it hasn't fixed the problem.

Now, this is the code that triggers the warning (or at least it's one
of the lines):

    if ( $title !~ m/$custer->name/i) {

FYI, "$centre" is a DBIx::Class as defined by the code example above.
Now that I've tracked it down that regex doesn't look right to me. If
I comment that out I get much fewer warnings. So I've changed it to
this:

    my $centre_name = $centre->name;
    if ( $title !~ m/$centre_name/i ) {

I understand (I think) why the regex is wrong but I don't understand
why it failed the way it did and generated the warnings that I got.
Need to kick up my Perl skills a notch. Meanwhile, can anyone explain?

Running the full regression suite there are a few more places left
where I get these warnings. So far they all concern regular
expressions but not always regex's that involve a DBIx::Class object.
I'll keep digging.

Thanks for offering to help.

Dan



More information about the DBIx-Class mailing list