in reply to Re: What's the opposite of // (err) operator?
in thread What's the opposite of // (err) operator?

No, I know to use Perl boolean rather than tests against actual values.

In the case at hand, I really want undef to stop subsequent work on the value. It's more like a database NULL, rather than a value of 0 (or an empty string). Maybe both of those are allowed values that I want to operate on.

  • Comment on Re^2: What's the opposite of // (err) operator?

Replies are listed 'Best First'.
Re^3: What's the opposite of // (err) operator?
by anonymized user 468275 (Curate) on May 12, 2011 at 13:42 UTC
    Problem with that is that NULL ( =undef() ) lacks even quasi-tautology as a test for mechanistic failure. I'd be inclined to keep the return value strictly for that and use references or instance subvariables to pass the actual database values between routines.

    DBI (to the extent I use it) sticks to these basic principles. If another required module doesn't, I'd use inheritance into a fairly trivial class that performs the separation between value logic and mechanistic logic for any "misbehaving" methods, rather than look for a way to do that throughout my higher level code.

    One world, one people