On Wednesday, May 1, 2002, at 02:27 PM, Aaron Sherman wrote:
unless my $fh = $x.open {
die Cannot open $x: $!;
} else while $fh.getline - $_ {
print;
} else {
die No lines to read in $x;
}
I think you need a better
On Wed, 2002-05-01 at 18:47, Damien Neil wrote:
On Wednesday, May 1, 2002, at 02:27 PM, Aaron Sherman wrote:
unless my $fh = $x.open {
die Cannot open $x: $!;
} else while $fh.getline - $_ {
print;
} else {
die No lines to read in $x;
with p5, Ive often written
eval {} or carp $ blah;
it seems to work, and it reads nicer (to my eye) than
eval {}; if ($) {}
but I surmise that it works cuz the return-value from the block is non-zero,
for successful eval, and 0 or undef when block dies, not cuz of magical
treatment of $@.
On Thu, 2 May 2002, Jim Cromie wrote:
with p5, Ive often written
eval {} or carp $ blah;
it seems to work, and it reads nicer (to my eye) than
eval {}; if ($) {}
but I surmise that it works cuz the return-value from the block is non-zero,
for successful eval, and 0 or undef when
On Thu, May 02, 2002 at 02:33:42PM -0600, Jim Cromie wrote:
with p5, Ive often written
eval {} or carp $ blah;
You generally Don't Want To Do That.
If the eval succeeds, but the last statement in the eval happens to come
out as false, then it'll still carp:
$a = 0; eval { 1 $a } or
At 02:33 PM 5/2/02 -0600, Jim Cromie wrote:
eval {} or carp $ blah;
it seems to work, and it reads nicer (to my eye) than
eval {}; if ($) {}
% perl -le 'eval { print No exceptions here; 0 } or warn $ blah'
No exceptions here
blah at -e line 1.
--
Peter Scott
Pacific Systems Design
Jim Cromie wrote:
with p5, Ive often written
eval {} or carp $ blah;
it seems to work,
modulo any block that returns false :-(
and it reads nicer (to my eye) than
eval {}; if ($) {}
but I surmise that it works cuz the return-value from the block is non-zero,
for successful