Skip Menu |

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

Report information
The Basics
Id: 52935
Status: resolved
Priority: 0/
Queue: Catalyst-Model-DBIC-Schema

People
Owner: Nobody in particular
Requestors: ozum [...] ozum.net
Cc:
AdminCc:

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



Subject: Broken Schema::Loader args with "sub { }" in Catalyst::Helper::Model::DBIC::Schema;
When feed code ref to loader args such as project_create.pl ........ inflect_singular="sub { $_[0] =~ /\A(.+?)(_id)?\z/; $1 }" moniker_map="sub { return join('', map ucfirst, split(/[\W_]+/, lc $table));" I get exception syntax error for loader args key 'moniker_map' with value 'ARRAY(0x35a74c4)': Undefined subroutine &Catalyst::Helper::Model::DBIC::Schema::ARRAY called at ( eval 258) line 1. Reason: _read_loader_args calls $self->_is_struct($val) on Line 279 but _is_struct tries to test it with return $val =~ /^\s*[[{]/; In above example inflect_singular option falls into else part in _read_loader_args and works, on the other hand moniker_map fals into elsif trying to evaluated as array which fails. This may solve the problem: return $val =~ /^\s*(sub|[[{])/;
Here is the patch Example in my previous post have typo, it should be: project_create.pl ........ inflect_singular="sub { $_[0] =~ /\A(.+?)(_id)?\z/; $1 }" moniker_map="sub { return join('', map ucfirst, split(/[\W_]+/, lc $table));}"
Download patch
application/octet-stream 169b

Message body not shown because it is not plain text.

Fixed in 0.32, thanks for the patch!