Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dancer-Plugin-SimpleCRUD CPAN distribution.

Report information
The Basics
Id: 73620
Status: resolved
Priority: 0/
Queue: Dancer-Plugin-SimpleCRUD

People
Owner: Nobody in particular
Requestors: rahul.kotamaraju [...] barclayscapital.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.30
Fixed in: (no value)



Subject: add/edit routes fail to add/edit records on submit when more than one database handle is present in config.yml
Module: Dancer::Plugin::SimpleCRUD Version: 0.30 Perl : 5.12.3 OS:Linux [snip] 2.6.18-128.1.1.el5 #1 SMP Mon Jan 26 13:58:24 EST 2009 x86_64 x86_64 x86_64 GNU/Linux On visiting the '/add' route a form is displayed correctly. However, when the record is submitted, there is an exception that states the app does not know which dsn to use. This could be because I have more than one database connection in my config.yml. I notice in the source code for SimpleCRUD.pm the following: <code> # Get a database connection to verify that the table name is OK, etc. my $dbh = database($args{db_connection_name}); </code> but elsewhere while using quick_(insert|update), $dbh is not used, instead keyword database (from Database plugin) is used as follows: <code> database->quick_insert($table_name, \%params); </code> Just to experiment I replaced all occurences of database- with $dbh- and I could get some success adding,viewing records. But there is another problem - The links for 'Add a new <record_label>', etc point to routes that use an incorrect prefix (I am guessing from history.back()) Thank you in advance
From: rahul.kotamaraju [...] barclayscapital.com
On Fri Dec 30 12:46:06 2011, kvrahul wrote: Show quoted text
> Module: Dancer::Plugin::SimpleCRUD > Version: 0.30 > Perl : 5.12.3 > OS:Linux [snip] 2.6.18-128.1.1.el5 #1 SMP Mon Jan 26 13:58:24 EST 2009 > x86_64 x86_64 x86_64 GNU/Linux > > On visiting the '/add' route a form is displayed correctly. However, > when the record is submitted, there is an exception that states the
app Show quoted text
> does not know which dsn to use. This could be because I have more than > one database connection in my config.yml. I notice in the source code > for SimpleCRUD.pm the following: > > <code> > # Get a database connection to verify that the table name is OK, > etc. > my $dbh = database($args{db_connection_name}); > </code> > > but elsewhere while using quick_(insert|update), $dbh is not used, > instead keyword database (from Database plugin) is used as follows: > > <code> > database->quick_insert($table_name, \%params); > </code> > > Just to experiment I replaced all occurences of database- with $dbh- > and I could get some success adding,viewing records. But there is > another problem - The links for 'Add a new <record_label>', etc point
to Show quoted text
> routes that use an incorrect prefix (I am guessing from
history.back()) Show quoted text
>
It appears the prefix being used in "_construct_url" sub is from the one that appears last in bin/app.pl. For example - If bin/app.pl contains the following <code> #!/bin/env/ perl use Dancer; use ModWithSimpleCRUD; use A; use B; </code> Then the Dancer::App->current->prefix contains the prefix defined in B.pm. Show quoted text
> Thank you in advance
.. I'm really sorry this ticket has sat untouched for so long. I don't recall getting the mail for it, and I don't watch RT that closely these days, I use GitHub issues more, but I still should have noticed it. I shall investigate this ASAP and check if it's still a problem. Sorry again.
Happy to say 0.71 was just pushed to CPAN, containing fixes for both these issues. Thanks for reporting them, and sorry again for how long it took me to see the report and issue a fix!