line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Distance::XS; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
76582
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
163
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
292
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
33
|
use Carp qw(croak); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
1262
|
|
7
|
4
|
|
|
4
|
|
5182
|
use Geo::Distance; |
|
4
|
|
|
|
|
139823
|
|
|
4
|
|
|
|
|
133
|
|
8
|
4
|
|
|
4
|
|
83
|
use XSLoader; |
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
862
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.13'; |
11
|
|
|
|
|
|
|
our $XS_VERSION = $VERSION; |
12
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
XSLoader::load(__PACKAGE__, $XS_VERSION); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($orig_distance_sub, $orig_formula_sub); |
17
|
|
|
|
|
|
|
BEGIN { |
18
|
4
|
|
|
4
|
|
18
|
$orig_distance_sub = \&Geo::Distance::distance; |
19
|
4
|
|
|
|
|
348
|
$orig_formula_sub = \&Geo::Distance::formula; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %formulas; @formulas{qw(hsin cos mt tv gcd polar alt)} = (1, 2, 2..6); |
23
|
|
|
|
|
|
|
our @FORMULAS = sort keys %formulas; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub import { |
26
|
4
|
|
|
4
|
|
33
|
no warnings qw(redefine); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
215
|
|
27
|
4
|
|
|
4
|
|
23
|
no strict qw(refs); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
827
|
|
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
4
|
|
35
|
*Geo::Distance::distance = \&{__PACKAGE__.'::distance'}; |
|
4
|
|
|
|
|
25
|
|
30
|
|
|
|
|
|
|
*Geo::Distance::formula = sub { |
31
|
7
|
|
|
7
|
|
7985
|
my $self = shift; |
32
|
7
|
50
|
|
|
|
18
|
if (@_) { |
33
|
7
|
|
|
|
|
12
|
my $formula = shift; |
34
|
7
|
50
|
|
|
|
16
|
croak "Invalid formula: $formula" |
35
|
|
|
|
|
|
|
unless exists $formulas{$formula}; |
36
|
7
|
|
|
|
|
10
|
$self->{formula} = $formula; |
37
|
7
|
|
|
|
|
17
|
$self->{formula_index} = $formulas{$formula}; |
38
|
|
|
|
|
|
|
} |
39
|
7
|
|
|
|
|
11
|
return $self->{formula}; |
40
|
4
|
|
|
|
|
100
|
}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Fall back to pure perl after calling 'no Geo::Distance::XS'. |
44
|
|
|
|
|
|
|
sub unimport { |
45
|
4
|
|
|
4
|
|
27
|
no warnings qw(redefine); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
378
|
|
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
|
|
*Geo::Distance::formula = $orig_formula_sub; |
48
|
0
|
|
|
|
|
|
*Geo::Distance::distance = $orig_distance_sub; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |