http://www.perlmonks.org?node_id=810975


in reply to Re: RFC: A new module to help avoid running multiple instances of the same script (via cron, for example)
in thread RFC: A new module to help avoid running multiple instances of the same script (via cron, for example)

++merlyn. I followed the highlander link and spotted this in the code listing at line 4:
open HIGHLANDER, ">>/tmp/renew.cgi.highlander" or die "Cannot open hig +hlander: $!";
I never (ever!) thought I would have cause to correct merlyn, but this contains one of my pet peeves, error messages which don't tell you what's happening, e.g.
Cannot open highlander: No disk space at ... Cannot open highlander: Permission denied at ...
Analyzing any problem requires the support person to read the code to discover the problem filename. They don't want to do that (and in a compiled language they can't), they just want to fix the problem. Suggest this:
my $highlander = '/tmp/renew.cgi.highlander'; open HIGHLANDER, ">>$highlander" or die "Cannot open $highlander: $!";
Cannot open /tmp/renew.cgi.highlander: No disk space at ... Cannot open /tmp/renew.cgi.highlander: Permission denied at ...