File Coverage

blib/lib/Email/Address/JP/Mobile.pm
Criterion Covered Total %
statement 17 19 89.4
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 25 28 89.2


line stmt bran cond sub pod time code
1             package Email::Address::JP::Mobile;
2 5     5   13189 use strict;
  5         10  
  5         193  
3 5     5   26 use warnings;
  5         8  
  5         133  
4 5     5   137 use 5.008000;
  5         16  
  5         278  
5             our $VERSION = '0.08';
6 5     5   3785 use Email::Address::Loose;
  5         37414  
  5         35  
7              
8 5     5   24 sub _carriers { qw(
9             DoCoMo
10             EZweb
11             AirH
12             SoftBank
13             NonMobile
14             ) }
15              
16             BEGIN {
17 5     5   471 for (_carriers) {
18 5     5   1277 eval "use Email::Address::JP::Mobile::$_;"; ## no critic
  5         8093  
  0         0  
  0         0  
19 5 50       8560 die $@ if $@;
20             }
21             };
22              
23             sub new {
24             my ($class, $address) = @_;
25             my ($email) = Email::Address::Loose->parse($address);
26             return unless $email;
27            
28             my ($carrier) =
29             grep { $_->matches($email) }
30             map { "Email::Address::JP::Mobile::$_" }
31             _carriers;
32              
33             $carrier->new;
34             }
35              
36             sub Email::Address::carrier {
37             __PACKAGE__->new(shift->address);
38             }
39              
40             1;
41             __END__