good chemistry is complicated,
and a little bit messy -LW
Re^2: RFC: A new module to help avoid running multiple instances of the same script (via cron, for example)by ikegami (Pope)
|on Dec 03, 2009 at 23:06 UTC||Need Help??|
It checks the reason for why flock failed instead of assuming it's because the file is already locked.
flock returns error EWOULDBLOCK on unixy systems and error 33 on Windows.
Correct. In my version, the END sub kept it alive.
First, :name traditionally has a meaning already. Dashes are usually used for options. As a bonus, -foo means the same thing as '-foo' even when strict is in use, so less quoting is needed.
Secondly, suppressing the message by default is a bad idea. The option should silent the message when provided.
On to the good stuff,
is the same as
so you need to create a method called import that looks like
But it won't work. The problem is that the module has already been executed (and the lock obtained) by require before import is called.
But you know what? The option isn't really needed. The message can always be suppressed on the command line by using output redirection.
Yet you had to write it and needed help to do so. You can also credit whoever you want in the docs.