Re: trouble with stringify
[prev]
[thread]
[next]
[Date index for 2005/04/25]
>>>>> "Perrin" == Perrin Harkins <perrin@xxxx.xxx> writes:
Perrin> You may be running into a slightly different version of this bug than I
Perrin> saw, but I suspect it's the same thing. In my case, I would create a
Perrin> new object whose definition includes a has_a on part of its primary key,
Perrin> and then calls to the accessor with the has_a would give me the string
Perrin> rather than the object. Undef'ing the object and re-fetching it would
Perrin> make the has_a work, but I couldn't take that chance of forgetting to do
Perrin> that so I just got rid of the has_a and made my own accessor for the
Perrin> linked object.
Ahh, but it's so convenient to simply say:
[% FOR role IN actor.roles %]
[% role.film %] (released in [% role.film.year %])
[% END %]
The first gets the stringified film. The second uses role.film
in its object sense to get the rest of the data for that film:
in this case, the year.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxx.xxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
|
(message missing)
|