DrHyde / perl-modules-Number-Phone

Number::Phone and friends
24 stars 32 forks source link

Can't locate Number/Phone/StubCountry/SharedCostServices.pm #57

Closed theory closed 8 years ago

theory commented 8 years ago

Started seeing errors like this in our logs. WTF kind of number is that? Is SharedCostServices a real thing?

It might be useful to change the exception to also log the number that was parsed, to make it easier to try to reproduce the error.

theory commented 8 years ago

Here's another one:

Can't locate Number/Phone/StubCountry/InternationalPremium
DrHyde commented 8 years ago

Ah yes, I believe are those weird international services in +8NN and +9NN. At least some of the necessary data appears to be in libphonenumber - eg https://github.com/googlei18n/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml#L24948 - so I should be able to extract them.

DrHyde commented 8 years ago

I think you're using an old version of Number::Phone. As of commit 5a7e11f2 you shouldn't ever see this.

DrHyde commented 8 years ago

See https://github.com/DrHyde/perl-modules-Number-Phone/issues/8

theory commented 8 years ago

Bah, sure enough, we're running 3.0006 in prod. :-(

theory commented 8 years ago

Oh, wait, that commit was in 2.12, which was a long time ago. We're running into this issue in 3.0006. Will get on 3.0014 shortly and see if it persists.

theory commented 8 years ago

Okay, it turns out that the $SIG{__DIE__} handler I mentioned in #44 is in fact screwing things up. Checking $^S does not do the trick. Grrr.

theory commented 8 years ago

Okay, the issue in our code is that the $SIG{__DIE__} handler looked like this:

$SIG{__DIE__} = sub {
    return if $^S;
    die @_;
};

But $^S is undef when doing, say, eval "use $pkg";. So I've changed it to

$SIG{__DIE__} = sub {
    return if $^S // 1;
    die @_;
};

And now it shouldn't log an error.