Subject: | 21.test_dvdzbr.t and 31.test_rest.t fail on perl 5.14 |
both tests die with:
' Caught exception in DVDzbr::Controller::User->edit "Can't locate
object method "name" via package "DVDzbr::Model::DBICSchemamodel::Role"
at ...'
I guess that this is related to changes in
HTML::FormHandler::TraitFor::Model::DBIC, but I am not 100% sure.
The problem came up after upgrading HTML::FormHandler::Model::DBIC.
I have attached a patch which solves the problem by changing the name of
the row which stores the roles name form 'role' to 'name' (in the
databases 'role'-table).
An other possibility would be to set a correct 'label_column' attribute
for the 'roles'-field within the created HFH-Forms.
The patch also removes the deprecated 'UTF8Columns' from
DBIx::Class::Schema::Result - files generated by instantcrud.pl.
This is a quick-and-dirty solution. There might be better ways to solve
the problem, but my patch is good enough to make InstantCRUD usable
again for perl-5.12.3 and perl-5.14.0, with a current version of HFH
installed.
I have tested the patch on RHEL and Debian (unstable), using 32 and 64
bit machines.
kind regards, LUKAST
Subject: | instantcrud.patch |
--- Catalyst-Example-InstantCRUD-0.038/script/instantcrud.pl 2011-03-17 22:46:36.000000000 +0100
+++ Catalyst-Example-InstantCRUD-0.038-patched/script/instantcrud.pl 2011-05-19 14:43:13.000000000 +0200
@@ -117,7 +117,8 @@
dump_directory => dir( $appdir , 'lib')->absolute->stringify,
use_namespaces => 1,
# default_resultset_class => '+DBIx::Class::ResultSet::RecursiveUpdate',
- components => [ 'InflateColumn::DateTime', 'UTF8Columns' ],
+ #components => [ 'InflateColumn::DateTime', 'UTF8Columns' ],
+ components => [ 'InflateColumn::DateTime', ],
},
[ $dsn, $duser, $dpassword ],
);
@@ -146,7 +147,7 @@
$addition .= "__PACKAGE__->many_to_many('$a0', '$a1' => '$a2');\n";
}
my @columns = $result_source->columns;
- $addition .= "__PACKAGE__->utf8_columns(qw/@columns/);\n";
+ # $addition .= "__PACKAGE__->utf8_columns(qw/@columns/);\n";
$content =~ s/1;\s*/$addition\n1;/;
File::Slurp::write_file( $file, $content );
}
@@ -398,7 +399,7 @@
INSERT INTO "dvdtag" VALUES(1,6);
CREATE TABLE role (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- role VARCHAR(255)
+ name VARCHAR(255)
);
INSERT INTO "role" VALUES(1,'Write');
INSERT INTO "role" VALUES(2,'Read');