perl-modules-Number-Phone icon indicating copy to clipboard operation
perl-modules-Number-Phone copied to clipboard

Expose the reason for a number being invalid

Open Tux opened this issue 8 years ago • 2 comments

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, ...)

Tux avatar Feb 20 '17 17:02 Tux

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?

DrHyde avatar Feb 22 '17 16:02 DrHyde

FINE WITH ME! (capitalized to show enthusiasm)

Tux avatar Feb 22 '17 18:02 Tux