in reply to An example of programming by contract

function to return both a false value and also set an error string
I hate to add a second semi-serious node to this thread but that reminds me of Fastolfe rather clever attempt to solve the same problem. He essentially creates strings that evaluate to false in boolean context... So, you can return false-with-an-error-message all in one scalar. Even the author doesn't recommend it for production use (since false-strings are non-intuitive to the sane perl programmer) but it is still an interesting approach.

-Blake

  • Comment on Re: An example of programming by contract