| 1 | package App::JYJ; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '0.0.2'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use JSON::PP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use YAML::PP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use IO::All; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use Mo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 14 | 0 | my $input = io('-')->utf8->all; | |||||||||
| 15 | 0 | my $output; | |||||||||
| 16 | 0 | my $json = JSON::PP->new->pretty->indent_length(2); | |||||||||
| 17 | 0 | my $yaml = YAML::PP->new; | |||||||||
| 18 | 0 | ▶ | if ($input =~ /\A\s*[\{\[]/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | my $data = $json->decode($input); | |||||||||
| 20 | 0 | $output = $yaml->dump($data); | |||||||||
| 21 | } | ||||||||||
| 22 | else { | ||||||||||
| 23 | 0 | my $data = $yaml->load_string($input); | |||||||||
| 24 | 0 | $output = $json->encode($data); | |||||||||
| 25 | } | ||||||||||
| 26 | 0 | ▶ | $output .= "\n" unless $output =~ /\n\z/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | binmode(STDOUT, ":utf8"); | |||||||||
| 28 | 0 | print $output; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 1; | |||||||||