The proper way to open()

David Cantrell david at cantrell.org.uk
Mon Jan 30 17:12:09 GMT 2012


On Mon, Jan 30, 2012 at 05:03:47PM +0000, James Laver wrote:
> On 30 Jan 2012, at 16:56, Dominic Thoreau wrote:
> > open IN, '<', $cfg || handle_that_error_sub;
> No, explicitly not. The || operator is far too high precedence binding. Use 'or' to remove your bug.

No.  The correct solution to buggy code caused by precedence is not to
invent a new level of precedence, but to use parens.  I do realise that
it was the p5p gang who invented the new level of precedence, but that
doesn't mean you should play along.

-- 
David Cantrell | London Perl Mongers Deputy Chief Heretic

What profiteth a man, if he win a flame war, yet lose his cool?


More information about the london.pm mailing list