| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package GIS::Distance::Formula; |
|
2
|
3
|
|
|
3
|
|
1293
|
use 5.008001; |
|
|
3
|
|
|
|
|
11
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strictures 2; |
|
|
3
|
|
|
|
|
16
|
|
|
|
3
|
|
|
|
|
104
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1938
|
use Class::Measure::Length qw( length ); |
|
|
3
|
|
|
|
|
49184
|
|
|
|
3
|
|
|
|
|
15
|
|
|
7
|
3
|
|
|
3
|
|
717
|
use Carp qw( croak ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
143
|
|
|
8
|
3
|
|
|
3
|
|
20
|
use Scalar::Util qw( blessed ); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
183
|
|
|
9
|
3
|
|
|
3
|
|
1566
|
use namespace::clean; |
|
|
3
|
|
|
|
|
47195
|
|
|
|
3
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $SELF; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
9
|
|
|
9
|
0
|
18
|
my $class = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
42
|
my $args = $class->BUILDARGS( @_ ); |
|
17
|
|
|
|
|
|
|
|
|
18
|
9
|
|
|
|
|
27
|
my $self = bless { %$args }, $class; |
|
19
|
9
|
|
|
|
|
80
|
$self->{code} = $class->can('_distance'); |
|
20
|
9
|
50
|
|
|
|
50
|
$self->BUILD() if $self->can('BUILD'); |
|
21
|
|
|
|
|
|
|
|
|
22
|
9
|
|
|
|
|
66
|
return $self; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub BUILDARGS { |
|
26
|
9
|
|
|
9
|
0
|
13
|
my $class = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return shift |
|
29
|
9
|
50
|
33
|
|
|
40
|
if @_==1 and ref($_[0]) eq 'HASH'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
9
|
|
|
|
|
23
|
return { @_ }; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub distance { |
|
35
|
33
|
|
|
33
|
0
|
8101
|
my $self = shift; |
|
36
|
|
|
|
|
|
|
|
|
37
|
33
|
|
|
|
|
58
|
my @coords; |
|
38
|
33
|
|
|
|
|
64
|
foreach my $coord (@_) { |
|
39
|
132
|
50
|
50
|
|
|
412
|
if ((blessed($coord)||'') eq 'Geo::Point') { |
|
40
|
0
|
|
|
|
|
0
|
push @coords, $coord->latlong(); |
|
41
|
0
|
|
|
|
|
0
|
next; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
132
|
|
|
|
|
226
|
push @coords, $coord; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
33
|
50
|
|
|
|
83
|
croak 'Invalid arguments passsed to distance()' |
|
48
|
|
|
|
|
|
|
if @coords!=4; |
|
49
|
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
55
|
local $SELF = $self; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return length( |
|
53
|
33
|
|
|
|
|
93
|
$self->{code}->( @coords ), |
|
54
|
|
|
|
|
|
|
'km', |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub distance_metal { |
|
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
60
|
0
|
|
|
|
|
|
return $self->{code}->( @_ ); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
|
64
|
|
|
|
|
|
|
__END__ |