wypm has asked for the wisdom of the Perl Monks concerning the following question:
I'm a Perl novice and trying to learn Catalyst. In the application I'm building, I saved some objects from resultset inside one action and redirected to the other function, but it displayed a blank page with exception
Can't call method "class" on an undefined value at /usr/local/lib/perl5/site_perl/5.10.0/DBIx/Class/ResultSourceHandle.pm line 81, at /usr/local/lib/perl5/site_perl/5.10.0/DBIx/Class/Serialize/Storable.pm line 14, at /usr/local/lib/perl5/site_perl/5.10.0/Object/Signature.pm line 19 Example of the codes:I did some web search and saw some responses that it's because the database connection was reset/lost during redirect, and it was suggested to use DBIx::Class::Schema freeze/thaw so solve the problem. But I have trouble understand the exact syntax to use freeze/thaw in the above codes. Thanks.sub foo { ... @some_records = $c->model("DB")->resultset("MyTable")->all; $c->session->{data} = \@some_records; ... $c->redirect->($c->uri_for('do_something')); } sub do_something { $c->stash->{template} = 'do_something.tt2'; } In do_something.tt2: [% FOREACH record IN c.session.data %] [% record.comment_field %] [% END %] etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catalyst redirect schema freeze/thaw example
by Your Mother (Archbishop) on Jul 16, 2009 at 00:33 UTC |