[Catalyst] Re: How to access current MyApp instance ?

Perrin Harkins perrin at elem.com
Thu Jul 5 16:15:57 GMT 2007


On 7/4/07, Jonathan Rockway <jon at jrock.us> wrote:
> I agree that this is a terrible way to do things.  Perl has the right idea
> with $sigils, so at least &functions look different from other @things.  Oh,
> and you know... a lexical scope.

If you feel the need for complicated scoping rules in your templates,
you probably should be using in-line perl in them rather than a
mini-language.  There are plenty of options for that, including TT2.

For those out there who like TT2's mini-language, I've been using it
for many years without ever encountering any of the problems described
in this thread.  I never add any variables to the stash from inside my
templates (temporary loop variables excluded), avoid MACRO (I only use
PROCESS), and generally keep the templates  very, very simple.  And I
have documentation that describes the data structure that will be in
the stash for each page.

Templates aren't normal code (even with in-line perl) and they don't
handle complexity like real code does, so you have to control your
impulse to turn them into thousands of little components.  It just
gets too confusing.

- Perrin



More information about the Catalyst mailing list