Skip Menu |
 

This queue is for tickets about the Catalyst-Model-DBI CPAN distribution.

Report information
The Basics
Id: 63105
Status: new
Priority: 0/
Queue: Catalyst-Model-DBI

People
Owner: Nobody in particular
Requestors: WATCHDOG [...] cpan.org
Cc: wat4dog [...] gmail.com
AdminCc:

Bug Information
Severity: Important
Broken in: 0.28
Fixed in: (no value)



CC: wat4dog [...] gmail.com
Download (untitled) / with headers
text/plain 1.8k
Hi! First - sorry for my english :( So, about bug which i found: In my case mysql.sock placed at wrong path (/var/lib/mysql instead of /var/run/mysql - I've reserched it after few fixes to your module, see below) and when i've tried to use my Model based on your Catalyst said me "can't call method "do" on undefined value", so, this is true, cuz $self->dbh was undef. Then I've tried to debug this, because Catalyst _debug (actually from your Catalyst::Model::DBI module) said me "Connected to database XXX via dsn YYY". And it wasn't true. Because your "connect" method "eval" DBI->connect and catch $@ as errors, but if $@ is empty, then this say "connected". So, DBI->connect doesn't throw exceptions, and when i've added DBI->errstr catching i've got nice result. Part of code: sub connect { my $self = shift; my $dbh; eval { $dbh = DBI->connect( $self->{dsn}, $self->{username} || $self->{user}, $self->{password} || $self->{pass}, $self->{options} ) || die DBI->errstr; ### plz attention here }; if ($@) { $self->{log}->debug( qq{Couldn't connect to the database "$@"} ) if $self->{debug} } else { $self->{log}->debug ( 'Connected to the database via dsn:' . $self->{dsn} ) if $self->{debug}; } $self->_pid( $$ ); $self->_tid( threads->tid ) if $INC{'threads.pm'}; return $dbh; } As you can see i've added || die DBI->errstr (force exception throwing). In this case $@ wasn't empty and i've seen ACTUAL error message "Can't connect to MySQL via socket /var/run/mysql.sock" I suggest you to add force exception throwing to fill $@ var with correct error message, to allow users see actual errors/problems :) Thank you for your attention, and I'm so sorry for my english. I hope what you'll understand me :) -- WBR, Anton.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.