Group
Extension

Matches 2

Data-Format-Pretty-JSON ( P/PE/PERLANCAR/Data-Format-Pretty-JSON-0.12.tar.gz, PERLANCAR, 2016; MetaCPAN )
Data-Format-Pretty-JSON/lib/Data/Format/Pretty/JSON.pm ( view source; MetaCPAN )
package Data::Format::Pretty::JSON;

our $DATE = '2016-03-11'; # DATE
our $VERSION = '0.12'; # VERSION

use 5.010001;
use strict;
use warnings;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_
 = qw(format_pretty);

sub content_type { "application/json" }

sub format_pretty {
    my ($data, $opts) = @_;
    $opts //= {};

    state $json;
    my $interactive = (-t STDOUT);
    my $pretty = 
equire JSON::Color;
        JSON::Color::encode_json($data, {pretty=>$pretty, linum=>$linum})."\n";
    } else {
        if (!$json) {
            require JSON::MaybeXS;
            $json = JSON::Mayb
Data-Format-Pretty-JSON ( P/PE/PERLANCAR/Data-Format-Pretty-JSON-0.12.tar.gz, PERLANCAR, 2016; MetaCPAN )
Data-Format-Pretty-JSON/lib/Data/Format/Pretty/CompactJSON.pm ( view source; MetaCPAN )
actJSON;

use 5.010;
use strict;
use warnings;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(format_pretty);

our $VERSION = '0.12'; # VERSION

sub content_type { "application/json" 
ata, $opts) = @_;
    state $json;

    $opts //= {};

    if ($opts->{color} // $ENV{COLOR} // (-t STDOUT)) {
        require JSON::Color;
        JSON::Color::encode_json($data, {pretty=>0, linum=>0
});
    } else {
        if (!$json) {
            require JSON::MaybeXS;
            $json = JSON::MaybeXS->new->utf8->allow_nonref;
        }
        $json->encode($data);
    }
}

1;
# ABSTRACT: Pr

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.