[Catalyst] Question about Angerwhale Catalyst Application

Jonathan Rockway jon at jrock.us
Fri Feb 9 19:52:38 GMT 2007


John Napiorkowski wrote:
> I was under the impression that it you needed the
> context in a component you needed to override
> ACCEPT_CONTEXT, since new is only called once when the
> application starts up.  Using ACCEPT_CONTEXT
> transforms your component to a type Class, since it
> creates a new object for each request instead of using
> the same one over and over.  But maybe I am not
> understanding it?
>
>
> Appreciate some thoughts, just trying to improve my
> best practices.

I only need $c so I can get at $c->cache and $c->model('UserStore') at
the beginning.  Also, that code was written before I knew about
ACCEPT_CONTEXT -- Angerwhale was my first foray into Catalyst.  Despite
that, it's proven extremely easy to maintain, extend, and refactor.

For now, consider Angerwhale a "get 'er done" thing, not a Catalyst
best-practices guide.  There's lots of awesome messy code in there.
(See all the default actions, for example.)

Fixes welcome -- mail me if you want a svn account.

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst mailing list