in reply to Re: Preventing multiple instances
in thread Preventing multiple instances
my $highlander; BEGIN { open $highlander, '<', $0 or die "Couldn't open $0: $!\n"; flock $highlander, LOCK_EX | LOCK_NB or do { warn "There can only be one $0\n"; exit; }; }
I am confused by there being a do { warn "XXX"; exit; } in this snippet rather than a simple die "XXX", especially seeing as how you are calling die if the open fails in the preceding statement. Would you be so kind as to explain the reasoning, please?
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Preventing multiple instances
by davido (Cardinal) on Jun 04, 2021 at 15:44 UTC |