[Catalyst] Proper way to perform cleanups on server shutdown?

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Wed Jul 11 19:02:43 GMT 2007






> Pressing Ctrl-C is how the tutorial tells me to exit
> the development server (when running foregrounded).
> However this will definitely cause trouble with code
> that uses END blocks, particularly for cleanup.  So
> what I am trying to figure out is a good way to
> canonically signal a catalyst application to
> gracefully stop or restart.  This would be a way that
> would respect any cleanup handling.
>
> We have a run command for Catalyst::Engine, perhaps it
> would be good to have a stop and restart here as well?
>  Or maybe saying this displays too much ignorance on
> my part, but I have to start somewhere :)
>
> I guess I would like to help to try and clarify and
> document the behavior.  I just could use some guidance
> from people with more intimate understanding of the
> system.  Maybe this is something more for the
> development list?
>
> Thanks!
>
> John


Your app may be better served cleaning up on launch instead of exit, END
blocks do not handle SIGs,  and even when you are trapping SIGs with
cleanup subs there are many that are untrapable or different in slight ways
across platforms.  In that case the next time you start the app (if it is
expecting cleaned up junk) it will be surprised to find it is not.

No matter what if your app does these check on startup you will be able to
handle them gracefully (or die() trying).

-Wade




More information about the Catalyst mailing list