http://qs321.pair.com?node_id=130786


in reply to Re: CGI Error Handling
in thread CGI Error Handling

I like the idea of putting code in eval-blocks, but is this also efficient/state-of-the-art/perlish?
eval { open(FH, $file) or die "NO_OPEN"; $text = join('', <FH>) or die "NO_READ"; close(FH) or die "NO_CLOSE"; } if ($@) { ... }
instead of
open(FH, $file) or &error("NO_OPEN", $file, $!); my $text = join('', <FH>) or &error("NO_READ", $file, $!); close(FH) or &error("NO_CLOSE", $file, $!);
What approach do you find better?