Mailing List Archive

on the CLEANUP call
hello all,

once embperl finishes processing an embperl page, it calls the CLEANUP
handler if it exists. That I know and succesfully tested.

But I'm using a few custom modules, and I'd like them *all* to receive
a CLEANUP call. I've been able to call CLEANUP in one module, by
exporting it, but I need that each and every imported module gets its
call. Without writing a CLEANUP handler per page, that is.

Is there any sound strategy, besides writing a module of my own to
catch the global CLEANUP call and broadcast it to my modules?


martin
Re: on the CLEANUP call [ In reply to ]
>
> Is there any sound strategy, besides writing a module of my own to
> catch the global CLEANUP call and broadcast it to my modules?
>
If you running under mod_perl you can use a PerlCleanupHandler to do cleanup
work (that's the same time when CLEANUP is called from Embperl). (you can
also dynamicly register it with register_cleanup method of mod_perl).

If you are using CGI, you may simply add the calls to the end of your
embpcgi.pl

Gerald


-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
Re: on the CLEANUP call [ In reply to ]
gerald,

i'm running under mod_perl, of course. otherwise END would just
suffice, I guess. my worries is that a few DBI connections I'm making
with Tie::DBI are effectively shut down.

how can I check that *which* variables *not* are being cleaned
up after each call? is there a way?

maybe I could register_cleanup from the module, but I guess
that'd make a mess: a module gets 'used' by an embperl page, and
registers a cleanup handler. Then embperl finishes processing, cleans up
everything and right afterwards comes mod_perl, calling the registered
method. sounds like a recipe for coredump hell.


martin
Re: on the CLEANUP call [ In reply to ]
>
> how can I check that *which* variables *not* are being cleaned up after
> each call? is there a way?
>

Embperl cleans up only variables of your page, not variables of other
namespace or modules.

You can see which variables are cleaned up by setting the dbgShowCleanup
debug flag


> mayb I could register_cleanup from the module, but I guess that'd make
> a mess: a module gets 'used' by an embperl page, and registers a cleanup
> handler. Then embperl finishes processing, cleans up everything and
> right afterwards comes mod_perl, calling the registered method. sounds
> like a recipe for coredump hell.
>

It wouldn't get so bad, because Perl cares about that. The most bad thing
that could happen, is that you get some waring or errors about undefined
variables.

Gerald


-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------