Demo ASP: register_cleanup.asp | 2024-10-10 |
Try this. Hit reload, then your browser STOP button quickly. Do this repeatedly. Then let the script execute normally. You will see the registered code executed appropriately.
Up through Apache version 1.3.4, this method is important, because mod_perl halts script execution immediately when the user hits a STOP button, so doing $Server->RegisterCleanup is the only way to consistently execute code that you have to for that script.
sleeping for 3 seconds...
sleeping 1 second...
sleeping 1 second...
sleeping 1 second...
Count incremented in $Server->RegisterCleanup 0