
torsten at apache
Mar 19, 2012, 7:25 AM
Post #1 of 1
(514 views)
Permalink
|
|
svn commit: r1302470 - in /perl/modperl/docs/trunk/src/docs/2.0/api: APR/Pool.pod Apache2/ServerUtil.pod
|
|
Author: torsten Date: Mon Mar 19 14:25:03 2012 New Revision: 1302470 URL: http://svn.apache.org/viewvc?rev=1302470&view=rev Log: pool cleanup exception behavior Modified: perl/modperl/docs/trunk/src/docs/2.0/api/APR/Pool.pod perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/ServerUtil.pod Modified: perl/modperl/docs/trunk/src/docs/2.0/api/APR/Pool.pod URL: http://svn.apache.org/viewvc/perl/modperl/docs/trunk/src/docs/2.0/api/APR/Pool.pod?rev=1302470&r1=1302469&r2=1302470&view=diff ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/api/APR/Pool.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/api/APR/Pool.pod Mon Mar 19 14:25:03 2012 @@ -103,12 +103,23 @@ To pass more than one argument, use an A =item excpt: -if the registered callback fails, it happens when the pool is -destroyed. The destruction is performed by Apache and it ignores any -failures. Even if it didn't ignore the failures, most of the time the -pool is destroyed when a request or connection handlers are long gone. -However the error B<is> logged to F<error_log>, so if you monitor that -file you will spot if there are any problems with it. +If a registered callback dies or throws an exception C<$@> is stringified +and passed to C<warn()>. Usually, this results in printing it to the +F<error_log>. However, a C<$SIG{__WARN__}> handler can be used to catch +them. + + $pool->cleanup_register(sub {die "message1\n"}); + $pool->cleanup_register(sub {die "message2\n"}); + my @warnings; + { + local $SIG{__WARN__}=sub {push @warnings, @_}; + $pool->destroy; # or simply undef $pool + } + +Both of the cleanups above are executed at the time C<$pool-E<gt>destroy> +is called. C<@warnings> contains C<message2\n> and C<message1\n> afterwards. +C<$pool-E<gt>destroy> itself does not throw an exception. Any value of C<$@> +is preserved. =item since: 2.0.00 Modified: perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/ServerUtil.pod URL: http://svn.apache.org/viewvc/perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/ServerUtil.pod?rev=1302470&r1=1302469&r2=1302470&view=diff ============================================================================== --- perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/ServerUtil.pod (original) +++ perl/modperl/docs/trunk/src/docs/2.0/api/Apache2/ServerUtil.pod Mon Mar 19 14:25:03 2012 @@ -841,6 +841,9 @@ F<startup.pl>. The function will croak i C<L<PerlPostConfigHandler|docs::2.0::user::handlers::server/C_PerlPostConfigHandler_>> phase. +Values returned from cleanup functions are ignored. If a cleanup dies the +exception is stringified and passed to C<warn()>. Usually, this results in +printing it to the F<error_log>. --------------------------------------------------------------------- To unsubscribe, e-mail: docs-cvs-unsubscribe [at] perl For additional commands, e-mail: docs-cvs-help [at] perl
|