[Catalyst] CatalystX::Declare stash problem

Alan Humphrey alan.humphrey at comcast.net
Tue Oct 26 05:57:30 GMT 2010


I'm converting an existing Catalyst app to use CatalystX::Declare.  The
conversion is going smoothly but I've run into a problem.

If I put a DBIC result set directly into the stash all is well when my Mason
template executes it:


	$ctx->stash->{ data } = $ctx->model("BirdWebDB::Orders")->search({
'me.taxonomic_order' => {'not' => undef},
	
'families.family_navigation_name' => { 'not' => undef }     },
	
{prefetch => 'families',
	
order_by => ['me.taxonomic_order', 'families.taxonomic_order']});

If I use the stash method I get an error:

	$ctx->stash( data => $ctx->model("BirdWebDB::Orders")->search({
'me.taxonomic_order' => {'not' => undef},
	
'families.family_navigation_name' => { 'not' => undef }     },
	
{prefetch => 'families',
	
order_by => ['me.taxonomic_order', 'families.taxonomic_order']}));

Odd number of elements in anonymous hash at
/usr/local/share/perl/5.10.1/Catalyst.pm line 474.
[info] *** Request 1 (0.000/s) [10296] [Mon Oct 25 22:39:31 2010] ***
[debug] "GET" request for "birds/browse" from "127.0.0.1"
[debug] Path is "/birds/browse"
[debug] Rendering component "/birdweb/browse_birds"
[error] Couldn't render component "birdweb/browse_birds" - error was "Can't
locate object method "next" via package
"BirdWeb::Admin::Model::BirdWebDB::Orders" at
/home/alanh/src/birdwebadmin/root/birdweb/browse_birds line 10.

The relevant template line:

% while (my $order = $c->stash->{data}->next) {

Any ideas?

Thanks!

- Alan




More information about the Catalyst mailing list