Exception Handling

David Cantrell david at cantrell.org.uk
Mon Jul 16 15:03:14 BST 2007

On Mon, Jul 16, 2007 at 09:35:42AM +0200, Luis Motta Campos wrote:

> >With that in mind, what do you think of my practice in  
> >Number::Phone et
> >al of returning 1 to mean "yes" (eg yes, this is a mobile number),  
> >0 to
> >mean "no" (no, it's not a mobile number) and undef for "dunno"?
>   Could you please provide us with an example of would trigger  
> "dunno" in your code?
>   Things tend to-be-or-not-to-be number phones, imho.

It would normally be where the module doesn't have any information about
a number.  As an example, Number::Phone::NANP::US has no information
about which numbers are mobile and which are not, because there doesn't
seem to be any convenient repository of this imformation.  And
Number::Phone::UK always returns undef for the is_government() method
because, unlike some countries, the UK doesn't have special number
ranges for government departments to use, their numbers are assigned
from the same pool as residential and (most) commercial numbers.

David Cantrell | Cake Smuggler Extraordinaire

Feature: an incorrectly implemented bug

More information about the london.pm mailing list