in reply to Re: Pattern for a shell-style call + error response
in thread Pattern for a shell-style call + error response

PBP numbers 63-65

Not having PBP, I don't know what 63-65 might be, but I do know that your way violates perlstyle:

open FOO, $foo or die "Can't open $foo: $!";
is better than
die "Can't open $foo: $!" unless open FOO, $foo;
because the second way hides the main point of the statement in a modifier. On the other hand
print "Starting analysis\n" if $verbose;
is better than
$verbose and print "Starting analysis\n";
because the main point isn't whether the user typed -v or not.
A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^3: Pattern for a shell-style call + error response
by Fletch (Bishop) on May 04, 2007 at 20:51 UTC

    If you're going to break the rules, might as well break them all . . . . :)

    My take has always been that using this makes it clear when abnormal termination is the main point (i.e. I expect this condition to be true, so take notice that we can terminate the program at this line).

    I understand why PBP and perlstyle recommend against it; however as I said I'm partial to it. Take it or leave it as you may.