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?
instead ofeval { open(FH, $file) or die "NO_OPEN"; $text = join('', <FH>) or die "NO_READ"; close(FH) or die "NO_CLOSE"; } if ($@) { ... }
What approach do you find better?open(FH, $file) or &error("NO_OPEN", $file, $!); my $text = join('', <FH>) or &error("NO_READ", $file, $!); close(FH) or &error("NO_CLOSE", $file, $!);
In Section
Seekers of Perl Wisdom