[NUUG fiksgatami] [patch] Use die or throw?
Petter Reinholdtsen
pere at hungry.com
Thu Feb 5 18:32:46 CET 2009
I came across a 'die' call in Page.pm. Should it be converted to a
exception throw?
Index: bci/perllib/Page.pm
===================================================================
RCS file: /repos/mysociety/bci/perllib/Page.pm,v
retrieving revision 1.137
diff -u -3 -p -u -r1.137 Page.pm
--- bci/perllib/Page.pm 2 Feb 2009 10:59:15 -0000 1.137
+++ bci/perllib/Page.pm 5 Feb 2009 16:52:47 -0000
@@ -824,7 +819,7 @@ sub process_photo {
close $fh;
my $out = `jhead -se -autorot $filename`;
if ($out) {
- open(FP, $filename) or die $!;
+ open(FP, $filename) or throw Error::Simple($!);
$photo = join('', <FP>);
close FP;
}
Happy hacking,
--
Petter Reinholdtsen
More information about the fiksgatami
mailing list