Skip Menu |

This queue is for tickets about the Plack-App-AutoCRUD CPAN distribution.

Report information
The Basics
Id: 102900
Status: resolved
Priority: 0/
Queue: Plack-App-AutoCRUD

People
Owner: DAMI [...] cpan.org
Requestors: richard [...] doubleprime.com
Cc:
AdminCc:

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



Subject: A bug in DBIx/DataModel/Schema/Generator.pm
Date: Fri, 20 Mar 2015 06:22:28 -0400
To: bug-Plack-App-AutoCRUD [...] rt.cpan.org
From: Richard Chen <richard [...] doubleprime.com>
Hi, I am trying out autocrud on a simple database in which I only have a couple of unrelated tables and I got errors like === 500 Server Error can't generate schema: no data. Call parse_DBI() or parse_DBIx_Class() before at ../../lib/App/AutoCRUD/DataSource.pm line 114. === I have traced this to the undef value for $self->{assoc} as shown below: [root@myserver html]# diff -u /u01/ops/perl-5.20.1/lib/site_perl/5.20.1/DBIx/DataModel/Schema/Generator.pm.sav /u01/ops/perl-5.20.1/lib/site_perl/5.20.1/DBIx/DataModel/Schema/Generator.pm --- /u01/ops/perl-5.20.1/lib/site_perl/5.20.1/DBIx/DataModel/Schema/Generator.pm.sav 2015-03-11 20:24:53.000000000 -0400 +++ /u01/ops/perl-5.20.1/lib/site_perl/5.20.1/DBIx/DataModel/Schema/Generator.pm 2015-03-20 04:07:48.823876390 -0400 @@ -288,7 +288,8 @@ my ($self) = @_; # check that we have some data - $self->{assoc} && $self->{tables} +# $self->{assoc} && $self->{tables} + $self->{tables} or croak "can't generate schema: no data. " . "Call parse_DBI() or parse_DBIx_Class() before"; I am not familiar with the autocrud code base yet but it appears that $self->{assoc} is for associations or relationships among the tables and if there are no relationship among the tables, then this value can be undef. This should not be considered as an error because autocrud should cover the simple cases as well as complicated ones. The above changes seems to have made my simple test database work. Please confirm if this is the case and if it needs to be fixed. It would also be nice to have some info about troubleshoot autocrud. I just used perl debugger on the command line but there may be better ways. Another issue is that if json output fails if you install the latest JSON and JSON::XS because calls like my $json_maker = JSON->new(%{$self->{json_args}}); does not work any more in the newer versions. I have not used autcrud much yet but it seems to be really useful. Thanks for your hard work. Thanks Richard Chen
Subject: Re: [rt.cpan.org #102900] A bug in DBIx/DataModel/Schema/Generator.pm
Date: Fri, 20 Mar 2015 21:44:51 +0200
To: bug-Plack-App-AutoCRUD [...] rt.cpan.org
From: Laurent Dami <laurent.dami [...] free.fr>
Le 20.03.2015 12:22, Richard Chen via RT a écrit : Show quoted text
> I am trying out autocrud
Hi Richard, thanks for your interest. Show quoted text
> can't generate schema: no data. Call parse_DBI() or parse_DBIx_Class() > before at ../../lib/App/AutoCRUD/DataSource.pm line 114. > ===
Indeed this is a bug in DBIx::DataModel (because I never thought of such a use case). I opened a child ticket for this point (102908). Show quoted text
> > It would also be nice to have some info about troubleshoot autocrud. > I just used perl debugger on the command line but there may be > better ways.
Well, when the application runs you get HTTP error messages; but if the bugs are at earlier stages, as in your case, then I don't see better ways than using the debugger. Show quoted text
> Another issue is that if json output fails if you install the latest > JSON and JSON::XS because calls like > > my $json_maker = JSON->new(%{$self->{json_args}}); > > does not work any more in the newer versions.
Thanks, I wasn't aware of this (unfortunate :-( ) change. Thanks for the bug report and detailed investigation.
On Fri Mar 20 06:22:41 2015, richard@doubleprime.com wrote: Show quoted text
> Another issue is that if json output fails if you install the latest > JSON and JSON::XS because calls like > > my $json_maker = JSON->new(%{$self->{json_args}}); > > does not work any more in the newer versions.
Patched in https://github.com/damil/App-AutoCRUD/commit/df668b3f96ea273e2bab13bac8e672f94c4a4f79
On 2015-03-20 13:59:19, DAMI wrote: Show quoted text
> On Fri Mar 20 06:22:41 2015, richard@doubleprime.com wrote: >
> > Another issue is that if json output fails if you install the latest > > JSON and JSON::XS because calls like > > > > my $json_maker = JSON->new(%{$self->{json_args}}); > > > > does not work any more in the newer versions.
> > Patched in > https://github.com/damil/App- > AutoCRUD/commit/df668b3f96ea273e2bab13bac8e672f94c4a4f79
I would suggest using JSON::MaybeXS here, as it provides an abstraction layer to multiple implementations as well as versions of JSON backends.
Subject: Re: [rt.cpan.org #102900] doesn't work with recent versions of JSON.pm because of changed API
Date: Sat, 21 Mar 2015 13:31:49 +0200
To: bug-Plack-App-AutoCRUD [...] rt.cpan.org
From: Laurent Dami <laurent.dami [...] free.fr>
Le 21.03.2015 02:11, Karen Etheridge via RT a écrit : Show quoted text
> I would suggest using JSON::MaybeXS here, as it provides an > abstraction layer to multiple implementations as well as versions of > JSON backends.
Thanks for the suggestion, I'll do so. I did not really follow the details of the controversy about JSON::XS, but using JSON::MaybeXS seems to be a good solution for maximum cross-compatibility.
Solved in v0.10, using JSON::MaybeXS