| 1 | package Geo::JSON::Role::ToJson; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 7 | our $VERSION = '0.007'; | |||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | # ABSTRACT: Moo::Role providing to_json() methods for a geojson object | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 7 | ▶ | use Moo::Role; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 42 | ▶ | sub to_json { | ||||||||||||||||||
|
Subroutine
to_json: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||
| 10 | 42 | my $self = shift; | |||||||||||||||||||
| 11 | 42 | ▶ | my $codec = shift || $Geo::JSON::json; | ||||||||||||||||||
|
Condition33%1/3
shift() || $Geo::JSON::json
MC/DC0%0/2
shift() || $Geo::JSON::json
shift()
$Geo::JSON::json
Truth table33%1/3
A || B
A= shift()B= $Geo::JSON::json
| |||||||||||||||||||||
| 12 | 42 | return $codec->encode($self); | |||||||||||||||||||
| 13 | } | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | # used by JSON 'convert_blessed' | ||||||||||||||||||||
| 16 | 22 | ▶ | sub TO_JSON { | ||||||||||||||||||
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 17 | 22 | return { type => $_[0]->type, %{ $_[0] } }; | |||||||||||||||||||
| 18 | } | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 7 | 1; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | __END__ | ||||||||||||||||||||