I have a simple autohandler that opens a DB connection and session 
(using Apache::Session) in the autohandler's <%init> block.  I also call 
$m->call_next and my autohandler doesn't generate any content itself.

I had been closing the DB connection and session in a <%cleanup> block 
but this isn't executed should I abort in one of my components.  In the 
Mason documentation, it states:

"If you need code that is guaranteed to run when the component or 
request exits, consider using a mod_perl cleanup handler, or creating a 
custom class with a DESTROY method."

However, I also note in the Mason docs that:

"A filter section will still be called after a component aborts with 
|$m->abort|."

My question is: is there any reason I can't simply use a <%filter> block 
to close my DB and session?  Seems to work fine in my limited testing.

If this isn't OK, what is the most straightforward Mason-friendly way to 
close DB connection and session should things go awry?

Thanks!



_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to