The proper way to open()

Mike Whitaker mike at altrion.org
Mon Jan 30 17:08:19 GMT 2012


On 30 Jan 2012, at 17:05, Roger Burton West wrote:

> On Mon, Jan 30, 2012 at 04:56:53PM +0000, Dominic Thoreau wrote:
> 
>> open IN, '<', $cfg || handle_that_error_sub;
> 
> OK, that's the same error I was making, so I'll point out that this will
> not fail as desired, but
> 
> open (IN, '<', $cfg) || handle_that_error_sub;
> 
> will.

There is of course the argument that if this is Not Meant To Happen In Normal Behaviour, you should let autodie do its thing and catch it in a 'whoops, my program did weird shit' try/catch much higher up.


More information about the london.pm mailing list