stas 2004/05/07 15:08:45 Modified: src/docs/2.0/api/APR Pool.pod Log: C<cleanup_register> doc Revision Changes Path 1.2 +55 -0 modperl-docs/src/docs/2.0/api/APR/Pool.pod Index: Pool.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Pool.pod,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Pool.pod 13 Jan 2004 02:51:49 -0000 1.1 +++ Pool.pod 7 May 2004 22:08:45 -0000 1.2 @@ -45,6 +45,61 @@ +=head2 C<cleanup_register> + +Register cleanup callbacks to run + + $pool->cleanup_register($callback); + $pool->cleanup_register($callback, $arg); + +=over 4 + +=item arg1: C<$p> (C<L<APR::Pool|docs::2.0::api::APR::Pool>>) + +The pool object to register the cleanup for + +=item arg2: C<$callback> (CODE ref or SUB name) + +a cleanup callback CODE reference or just a name of the subroutine +(fully qualified unless defined in the current package). + +=item opt arg3: C<$arg> (SCALAR) + +If this optional argument is passed the C<$callback> function will +receive it as the first and only argument when executed. + +To pass more than one argument, use a reference to an array or a hash. + +=item ret: no return value + +=item since: 1.99_10 + +=back + +Examples: + +No arguments, using anon sub as a cleanup callback: + + $r->pool->cleanup_register(sub { warn "running cleanup" }); + +One or more arguments using a cleanup code reference: + + $r->pool->cleanup_register(\&cleanup, $r); + $r->pool->cleanup_register(\&cleanup, [$r, $foo]); + sub cleanup { + my @args = (@_ && ref $_[0] eq ARRAY) ? @{ +shift } : shift; + my $r = shift @args; + warn "cleaning up"; + } + + +XXX: test that we can do: + + $r->pool->cleanup_register(sub { warn "running cleanup" }); + $r->pool->cleanup_register('foo'); + +in TestAPR/pool.pm + =head2 C<clear>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]