in reply to Re: how to convert lexical filehand so flock will work with it
in thread how to convert lexical filehand so flock will work with it

thanks, that makes sense.
  • Comment on Re^2: how to convert lexical filehand so flock will work with it

Replies are listed 'Best First'.
Re^3: how to convert lexical filehand so flock will work with it
by davido (Cardinal) on Jul 05, 2013 at 07:42 UTC

    Perl::Critic is probably wrong on this one... or at least, insensitive to valid use cases. That's a frequent issue with Perl::Critic; while the book was intended to encourage thoughtfulness with respect to best practices, the module doesn't do a very good job of trying to understand why your situation might justify using an item that it considers to be a violation. The best practice really is to know what you're doing, and why. The rest is just food for thought.

    By the way, you may find this slide interesting: MJD "Only one process running at a time", from Mark Jason Dominus's File Locking Tricks and Traps talk.

    Update: I almost forgot to mention -- this employs the "lock the DATA filehandle" trick, and allows you to avoid dealing directly with flocking: Sys::RunAlone.


    Dave