On Thu, 29 Jun 2000, Stas Bekman wrote:
> When using file locking one must make sure, that if the script has been
> stopped before the close() was called, to use an END block under Registry
> or $r->register_cleanup() anywhere. See:
> http://perl.apache.org/guide/debug.html#Handling_the_User_pressed_Stop_
> http://perl.apache.org/guide/debug.html#Cleanup_Code
>
> Otherwise you might get stuck with a stale lock, which will be never
> removed unless the same process will call open() on the same filehandler.
> And it'd be the same filehandler only if you use "open, IN ..." style, if
> you use Symbol module or perl5.6 filehandler autovivification a new unique
> filehandler will be created when the same code will run again.
>
> So close() under mod_perl is not enough when locking is used.
Are you suggesting that more has to be done even if you use my $fh type
opening? I'm not sure I believe you, if thats what you're suggesting - the
second paragraph there seems to confuse things. If you use my $fh style
opening (either the Symbol or 5.6 way) you need worry not about unlocking
files or cleanup code for unlocking/closing files - it's all done by the
garbage collector. (you should close your filehandles anyway though for
the sake of cleanliness and not leaving around locks, but my point was
merely the necessity of it).
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org