FAQ

Will Hawes wrote:
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.
Solved, turns out it was my crap implementation of end(), which did not
handle $c->error. For some reason this only came to light with 5.66.

Switching to Catalyst::Plugin::DefaultEnd with immediate effect...

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 23, '06 at 9:57a
activeMar 23, '06 at 2:37p
posts2
users1
websitecatalystframework.org
irc#catalyst

1 user in discussion

Will Hawes: 2 posts

People

Translate

site design / logo © 2021 Grokbase