I recently upgraded the DBIx::Class::Schema::Loader module (from ??? to
0.05003), and found that it broke a previously-working syntax, of
following a foreign key to another table. For instance, in the Catalyst
Perl sub, I do "$c->stash->{builds} = [$c->model('DB::Build')->all];"

Then, on the page (a TT page), I had a FOREACH loop "[% FOREACH build IN
builds -%]", and inside it, printed out various values for each of the
builds (server, version, source path, etc); one of these was a foreign
key to an "environment" table, which has columns for "name" and
"buildstring"; that line used to look like:

<td>[% build.environment_id.name %] ([%
build.environment_id.buildstring %])</td>

However, that syntax is no longer working; now I need to send the
environment in a separate $c->stash call (and in several other places,
in the Perl code, I have had to change it to do a lookup on the
intermediate table first, then get the value-the multiple "->" no longer

I realize this isn't strictly a Catalyst issue, but I do recall seeing a
suggestion on the list to upgrade that module to fix something else (I
think it was autocrud issues I was experiencing)-and now that it's
breaking this very useful syntax, I'm wondering:

a. if there's a way to bring it back easily (like adding some qw
to the "use" line?);

b. if I should revert to the working version (or some version in
between what I previously had (how do I determine that, after the
upgrade has already happened?), which fixes the autocrud issues but
doesn't break the "multiple '->'" usefulness); and

c. if there's perhaps some other solution?

For now, the solution I've used seems kludgey; I added to the Perl sub
this line: "$c->stash->{environments} =
$c->model('DB::Environment')->all;". And, instead of the one-liner
above in the TT, I now do 3 lines:

[% envid = build.environment_id -%]

[% env = environments.$envid -%]

<td>[% env.name %] ([% env.buildstring %])</td>


Ken Beal
Senior Software Engineer, Build/Release

Cross Country Automotive Services
One Cabot Road
Medford, MA 02155
p: (781) 306-3605
m: (978) 423-8977
e: kbeal@crosscountry-auto.com

Confidentiality Note: This e-mail message and any attachments may contain
confidential or privileged information. If you are not the intended recipient,
please notify me immediately by replying to this message and destroy all
copies of this message and any attachments. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100609/0dff9bfe/attachment.htm

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 9, '10 at 4:08p
activeJun 10, '10 at 11:34p



site design / logo © 2022 Grokbase