perl-modules-Number-Phone
perl-modules-Number-Phone copied to clipboard
Expose the reason for a number being invalid
It would be awesome is there would be a method or a global that enables me to see the reason for a number not being valid (invalid country code, too long, too short, invalid area code, invalid characters, ...)
Yes, it would!
I don't particularly like globals or extra methods for seeing why something failed, so what do you think about using objects that:
- numify as 0;
- stringify as "0" (just in case someone is mis-using the return value);
- boolify as false
and have a reason() method that would return one of a documented set of constants?
Or am I over-thinking this and should just suck up a bit of ugliness?
FINE WITH ME! (capitalized to show enthusiasm)