[Catalyst] Is it feasable to have OnEvent ?
Brandon Black
blblack at gmail.com
Tue Feb 14 17:57:25 CET 2006
On 2/14/06, raptor <raptor at tvskat.net> wrote:
>
> |On Mon, Feb 13, 2006 at 08:51:01PM +0200, raptor wrote:
> |> hi,
> |>
> |> I was thinking is it feasable Catalyst to have onEvent methods (onPageStart/End,onSessionStart/End,onApplicationStart/End,onTimeTick...) ?
> |> Just thinking ? We have such thing for onPageX !
> |
> |That made no sense at all. Please rephrase it so we have some idea what you're
> |talking about.
> |
> ]- Similar to what ASP framework have..f.e. attaching code so that it is executed at the beginng of the start of every Session.
>
onPageStart and onPageEnd have multiple effective equivalents with a
greater amount of flexibility. The most common places you would hook
that in would be the "auto" controller method and the "end" action.
onApplicationStart could be put in a number of places, so long as it
runs at startup time. Literal code in the body of lib/MyApp.pm would
do this, for example.
onApplicationEnd I'm not so sure about. I'm sure there's a way to do
it, I just can't picture it at the moment.
onTimeTick just doesn't even make sense in the context of a web
application server... I believe we do have a cron-like plugin if you
wanted to get something peridiocally executed.
onSessionStart/onSessionEnd don't have equivalents AFAIK, although you
could easily subclass one of the Session modules to hook in
onSessionStart-like behavior. When a session ends is an ill-defined
concept in general, and I don't know how your ASP environment defines
it either. Is it when the session cookie expires? Is it when the
session entry is reaped from the server-side session storage for
timeout reasons? Is it the first time a session-cookie-less request
comes in from a browser ip-address that used to have a session-cookie?
Now on the other hand if you mean that onSessionStart/onSessionEnd
should really behave more like onUserLogin/onUserLogout, those are
both very well defined, and easily hookable by subclassing the Auth
stuff.
-- Brandon
More information about the Catalyst
mailing list