Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

David Cantrell
David Cantrell

Posted on

     

Number::Phone release candidate

I've recently tackled a feature request that's been sitting in the backlog for several years, to use libphonenumber's data to validate numbers with non-geographic country codes. That's codes like +800 (international freephone), +870 (Inmarsat) and so on.

Previous versions would sort of work with these numbers, in that they could be instantiated as objects, but there was no information on validity or any other properties.

For example here it's looking at an Iridium number. First with the previous release:

Number::Phone->new("+881 672520333333333333333732")->format()

+8816 72520333333333333333732

Number::Phone->new("+881 672520732")->is_mobile()

undef (ie, dunno)

and with the release candidate:

Number::Phone->new("+881 672520333333333333333732")

undef (ie, not valid)

Number::Phone->new("+881 672520732")->format()

+881 6 725 20732

Number::Phone->new("+881 672520732")->is_mobile()

1

Much of the code is auto-generated, and this involved quite a bit of hacking around in the build system and object instantiation, so there's the potential for exciting new bugs even for numbers in boring old geographic country codes, although I didn't have to change any of the existing tests so I am hopeful that I avoided that.Here are the changes.

I'd be grateful if you could test this, and assuming that no-one finds any bugs it will be in either the March or June quarterly release. You can download it fromhere.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
drhyde profile image
David Cantrell
Perl grey-beard primarily interested in QA, and a larval-stage Rustacean. I've been computering for longer than most of you have been alive.
  • Joined

Of course the first release candidate was buggy, so there's a second onehere.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Perl grey-beard primarily interested in QA, and a larval-stage Rustacean. I've been computering for longer than most of you have been alive.
  • Joined

More fromDavid Cantrell

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp