line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Direction::Name; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
816159
|
use warnings; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
367
|
|
4
|
12
|
|
|
12
|
|
60
|
use strict; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
490
|
|
5
|
12
|
|
|
12
|
|
62
|
use Carp; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
951
|
|
6
|
|
|
|
|
|
|
|
7
|
12
|
|
|
12
|
|
10302
|
use version; our $VERSION = qv('0.0.4'); |
|
12
|
|
|
|
|
27034
|
|
|
12
|
|
|
|
|
72
|
|
8
|
12
|
|
|
12
|
|
1164
|
use Scalar::Util qw(looks_like_number); |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
1519
|
|
9
|
12
|
|
|
12
|
|
11946
|
use Class::Inspector; |
|
12
|
|
|
|
|
51183
|
|
|
12
|
|
|
|
|
404
|
|
10
|
12
|
|
|
12
|
|
10440
|
use UNIVERSAL::require; |
|
12
|
|
|
|
|
26170
|
|
|
12
|
|
|
|
|
127
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN |
13
|
|
|
|
|
|
|
{ |
14
|
12
|
50
|
|
12
|
|
647
|
if ( $] >= 5.006 ) |
15
|
|
|
|
|
|
|
{ |
16
|
12
|
|
|
|
|
77
|
require utf8; import utf8; |
|
12
|
|
|
|
|
91
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
822
|
|
|
822
|
1
|
1638774
|
my ( $class, $opt ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
822
|
|
|
|
|
3269
|
my $self = bless {}, $class; |
24
|
|
|
|
|
|
|
|
25
|
822
|
|
|
|
|
1949
|
my $spec; |
26
|
|
|
|
|
|
|
my $locale; |
27
|
822
|
50
|
66
|
|
|
7086
|
if ( $opt && ref($opt) ) { |
28
|
0
|
|
|
|
|
0
|
$spec = $opt->{spec}; |
29
|
0
|
|
|
|
|
0
|
$locale = $opt->{locale}; |
30
|
|
|
|
|
|
|
} else { |
31
|
|
|
|
|
|
|
# For backward compatibility |
32
|
822
|
|
|
|
|
1554
|
$locale = $opt; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
822
|
|
|
|
|
2042
|
$self->spec( $spec ); |
36
|
822
|
|
|
|
|
2212
|
$self->locale( $locale ); |
37
|
|
|
|
|
|
|
|
38
|
821
|
|
|
|
|
2809
|
$self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub spec { |
42
|
3160
|
|
|
3160
|
1
|
5000
|
my $self = shift; |
43
|
3160
|
|
|
|
|
4095
|
my $spec = shift; |
44
|
3160
|
|
|
|
|
3954
|
my $noerr = shift; |
45
|
3160
|
|
|
|
|
4995
|
my $errstr = "Specification class(subclass of Geo::Direction::Name::Spec) must be set"; |
46
|
3160
|
100
|
50
|
|
|
10679
|
$spec ||= 'default' unless ( $self->{spec} ); |
47
|
|
|
|
|
|
|
|
48
|
3160
|
100
|
|
|
|
6595
|
if ( $spec ) { |
49
|
822
|
|
|
|
|
1348
|
$errstr = "Geo::Direction::Name not support this specification now: " . $spec; |
50
|
822
|
|
|
|
|
1415
|
delete $self->{spec}; |
51
|
822
|
50
|
|
|
|
2552
|
my $class = __PACKAGE__ . '::Spec' . ( $spec eq 'default' ? '' : '::' . ucfirst($spec) ) ; |
52
|
822
|
50
|
66
|
|
|
4322
|
if( Class::Inspector->loaded($class) || $class->require ) { |
53
|
822
|
|
|
|
|
25772
|
$self->{spec} = $class->new; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
3160
|
50
|
33
|
|
|
14988
|
croak $errstr unless ( $noerr || $self->{spec} ); |
58
|
3160
|
|
|
|
|
11999
|
$self->{spec}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub locale { |
62
|
822
|
|
|
822
|
1
|
1553
|
my $self = shift; |
63
|
|
|
|
|
|
|
|
64
|
822
|
|
|
|
|
1695
|
$self->spec->locale( @_ ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub to_string { |
68
|
1323
|
|
|
1323
|
1
|
7988
|
my $self = shift; |
69
|
|
|
|
|
|
|
|
70
|
1323
|
|
|
|
|
3040
|
$self->spec->to_string( @_ ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub from_string { |
74
|
193
|
|
|
193
|
1
|
1787
|
my $self = shift; |
75
|
|
|
|
|
|
|
|
76
|
193
|
|
|
|
|
520
|
$self->spec->from_string( @_ ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
81
|
|
|
|
|
|
|
__END__ |