From 02e935da96b1b81d62a116998702638d0b21fb3f Mon Sep 17 00:00:00 2001 From: Darin McBride Date: Sat, 30 Jan 2016 22:07:03 -0700 Subject: [PATCH] Add fatal exception if open fails. It's not working at that point anyway if it fails, may as well give $! with the error message. --- lib/Lacuna/CaptchaFactory.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna/CaptchaFactory.pm b/lib/Lacuna/CaptchaFactory.pm index bee39faf..8e1a0360 100644 --- a/lib/Lacuna/CaptchaFactory.pm +++ b/lib/Lacuna/CaptchaFactory.pm @@ -260,7 +260,8 @@ sub construct { unless (-d $dir) { mkdir $dir; } - open my $file, '>', $dir.'/'.$self->guid.'.png'; + open my $file, '>', $dir.'/'.$self->guid.'.png' or + die "Can't write to $dir/".$self->guid.".png: $!"; print {$file} $image; close $file; $captchas->create({ -- 2.54.0