Skip to content

Commit

Permalink
minor tidying and removal of unreachable code
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed Jan 14, 2023
1 parent 67274c3 commit ce4e800
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
3 changes: 0 additions & 3 deletions buildtools/Number/Phone/BuildHelpers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ sub known_non_country_codes {
883130 => 'InternationalNetworks883::Mobistar',
883140 => 'InternationalNetworks883::MTTGlobalNetworks',
888 => 'TelecomsForDisasterRelief',
# 979 is used for testing when we fail to load a module when we
# know what 'country' it is
979 => 'InternationalPremiumRate',
991 => 'ITPCS',
# 999 deliberately NYI for testing; proposed to be like 888.
)
}

Expand Down
1 change: 0 additions & 1 deletion lib/Number/Phone.pm
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ sub _make_stub_object {
if($local_number eq '') { return undef; }
return bless({
country_code => $country_idd,
# country => $country_name,
is_valid => undef,
number => $local_number,
}, 'Number::Phone::StubCountry');
Expand Down
12 changes: 4 additions & 8 deletions lib/Number/Phone/StubCountry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ sub country_code {
my $self = shift;

return $self->{country_code};
# return exists($self->{country_code})
# ? $self->{country_code}
# : Number::Phone::Country::country_code($self->country());
}

sub country {
my $self = shift;
if(exists($self->{country})) { return $self->{country}; }
ref($self)=~ /::(\w+?)$/;
return $1;
return $self->{country} = $1;
}

sub raw_number {
Expand All @@ -43,9 +40,9 @@ sub is_valid {
return $self->{is_valid};
}
foreach (map { "is_$_" } qw(specialrate geographic mobile pager tollfree personal ipphone)) {
return 1 if($self->$_());
return $self->{is_valid} = 1 if($self->$_());
}
return 0;
return $self->{is_valid} = 0;
}

sub is_geographic { shift()->_validator('geographic'); }
Expand Down Expand Up @@ -75,7 +72,6 @@ sub areaname {
}
}
my $number = $self->raw_number();
return unless $self->{areanames};
LANGUAGE: foreach my $language (@languages) {
next LANGUAGE unless(exists($self->{areanames}->{$language}));
my %map = %{$self->{areanames}->{$language}};
Expand All @@ -96,7 +92,7 @@ sub format {
return join(' ', '+'.$self->country_code(), @bits);
}
}
return '+'.$self->country_code().' '.$number;
# return '+'.$self->country_code().' '.$number;
}

1;
4 changes: 2 additions & 2 deletions t/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
cover -delete
HARNESS_PERL_SWITCHES=-MDevel::Cover make test
cover
# HARNESS_PERL_SWITCHES=-MDevel::Cover make test
AUTOMATED_TESTING=1 cover -ignore_re ^buildtools/ -test

0 comments on commit ce4e800

Please sign in to comment.