in reply to Re: How to return errors from my object oriented subroutine
in thread How to return errors from my object oriented subroutine

Perhaps you have a distorted view of exceptions. I consider the "catch with eval {}" errors thrown by DBI to be a decent design, for example.

Use exceptions when an error return value from the method call would be either inconvenient or impossible to check for.

For a constructor, typically an undef value is returned for an exceptional case. For setters or getters, throwing exceptions seem to make more sense.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Re: How to return errors from my object oriented subroutine