[Catalyst] Template Toolkit oddity after upgrading to 5.66

Will Hawes info at whawes.co.uk
Thu Mar 23 10:57:24 CET 2006


I've just upgraded to Catalyst 5.66 and for some bizarre reason, setting 
$c->stash->{template} = 'template' now causes 'template' to be processed 
immediately, i.e. before forwarding to the view. This is demonstrated by 
controller code similar to the following:

sub edit : Local {
   my ( $self, $c ) = @_;
   my $resultset = $c->stash->{resultset};
   $c->stash->{template} = 'edit';
   die 'ok';
   $self->SUPER::edit( $c );
}

And in the template:

[%
WHILE ( item = resultset.next );
...
END;
%]

I'm using a DBIx::Class based model and use of the 
DBIX_CLASS_STORAGE_DBI_DEBUG environment variable reveals (via the test 
server's debug output) that an SQL SELECT statement is being run for 
each row in the resultset before the die() statement is reached.

The WHERE clause for my resultset is set by $self->SUPER::edit(). In the 
above example, the template code is running before the WHERE clause is 
set and looping over every record in the resultset's table as a result 
(i.e "SELECT * FROM table" as opposed to "SELECT * FROM table WHERE ..." ).

Any ideas as to the cause? The same code did not exhibit this behaviour 
prior to the upgrade.



More information about the Catalyst mailing list