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

It contravenes PBP numbers 63-65, but I'm still partial to die $libobj->GetErrorCode unless $item->frobinize( . . . ) == 0.

Replies are listed 'Best First'.
Re^2: Pattern for a shell-style call + error response
by jdporter (Paladin) on May 04, 2007 at 19:56 UTC
    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

      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.