line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::JSON::Role::ToJson; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Moo::Role providing to_json() methods for a geojson object |
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
60121
|
use Moo::Role; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
43
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub to_json { |
10
|
42
|
|
|
42
|
1
|
20228
|
my $self = shift; |
11
|
42
|
|
33
|
|
|
147
|
my $codec = shift || $Geo::JSON::json; |
12
|
42
|
|
|
|
|
328
|
return $codec->encode($self); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# used by JSON 'convert_blessed' |
16
|
|
|
|
|
|
|
sub TO_JSON { |
17
|
22
|
|
|
22
|
0
|
45
|
return { type => $_[0]->type, %{ $_[0] } }; |
|
22
|
|
|
|
|
200
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |