Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Doco, fix other tests what we broke with this incompatible change

  • Loading branch information...
commit 0e3977e45f879b07f50d14c616075342d288d64f 1 parent 9a7a343
@DrHyde DrHyde authored
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+2010-09-12 1.8 INCOMPATIBLE CHANGE: constructor will now return
+ a minimal object instead of undef if there's no
+ country-specific module available
+
2010-07-05 1.7101 Bugfix for N::P->new('CC', '+NN12345');
2010-07-02 1.7100 Bugfix for N::P->new('CC', '12345');
View
11 lib/Number/Phone.pm
@@ -99,8 +99,15 @@ and to magically use the right subclass ...
in the example, the +44 is recognised as the country code for the UK,
so the appropriate country-specific module is loaded if available.
-If you pass in a bogus country code or one for a country for which
-no supporting module is available, the constructor will return undef.
+
+If you pass in a bogus country code not recognised by
+Number::Phone::Country, the constructor will return undef.
+
+If you pass in a country code for which
+no supporting module is available, the constructor will return a
+minimal object that knows its country code and how to format a phone
+number, but nothing else. Note that this is an incompatible change:
+previously it would return undef.
=cut
View
8 t/30_find-right-subclass.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-use Test::More tests => 5;
+use Test::More tests => 4;
use Scalar::Util qw(blessed);
use Number::Phone;
@@ -23,11 +23,5 @@ ok(
!defined(Number::Phone->new("+999123")),
"A country code not recognised by N::P::Country returns false"
);
-# +979 is International Premium Rate Service
-ok(
- !blessed(Number::Phone->new("+979123")) &&
- !defined(Number::Phone->new("+979123")),
- "A country code whose module we can't find returns false"
-);
# FIXME - Kazakhstan/Russia weirdness
View
1  t/902_bugfix-rt61177.t
@@ -21,5 +21,4 @@ foreach my $prefix ('', '+') {
isa_ok($object, 'Number::Phone::StubCountry', "unknown countries return minimal objects".($prefix? " with a +" : ""));
is($object->country_code(), '44', "->country_code works");
is($object->format(), '+44 2087712924', "->format works");
-
}
Please sign in to comment.
Something went wrong with that request. Please try again.