Hi,

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:
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.
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.

In reply to Catalyst redirect schema freeze/thaw example by wypm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.