- Perrin On Mar 7, 2012 7:00 AM, "Torsten Förtsch" <torsten.foert...@gmx.net> wrote:
> On Friday, 02 March 2012 13:49:34 Perrin Harkins wrote: > > You can use $r-->child_terminate(). > > 2 remarks: > > 1) you can use this method at any point in the request cycle. It marks the > process to be terminated when the current request is done. > > 2) the way child_terminate() exits is quite nasty because it simply calls > exit() at C level. That means neither END blocks nor PerlChildExitHandlers > are > executed nor are static perl objects destroyed. > > Perhaps a more perlish way to terminate the current process is > > { > package My::Terminator; > sub DESTROY {CORE::exit 0} > sub new {return bless \my $dummy, __PACKAGE__} > } > $r->pnotes->{terminator}=My::Terminator->new; > > Thus, global Perl objects will be destroyed properly and the process exits > when the current request is done. > > If you are already using some kind of scope guard module (e.g. Guard) you > can > achieve the same even simpler: > > $r->pnotes->{terminator}=guard {CORE::exit 0}; > > Torsten Förtsch > > -- > Need professional modperl support? Hire me! (http://foertsch.name) > > Like fantasy? http://kabatinte.net >