App-cpanurl

 view release on metacpan or  search on metacpan

script/cpanurl  view on Meta::CPAN


# accessor


# pretty printing

sub pretty {
    my ($self, $v) = @_;
    my $enable = defined $v ? $v : 1;

    if ($enable) { # indent_length(3) for JSON::XS compatibility
        $self->indent(1)->indent_length(3)->space_before(1)->space_after(1);
    }
    else {
        $self->indent(0)->space_before(0)->space_after(0);
    }

    $self;
}

# etc

script/cpanurl  view on Meta::CPAN

            $keysort = ref($self->{sort_by}) eq 'CODE' ? $self->{sort_by}
                     : $self->{sort_by} =~ /\D+/       ? $self->{sort_by}
                     : sub { $a cmp $b };
        }

        encode_error("hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this)")
             if(!ref $obj and !$idx->[ P_ALLOW_NONREF ]);

        my $str  = $self->object_to_json($obj);

        $str .= "\n" if ( $indent ); # JSON::XS 2.26 compatible

        unless ($ascii or $latin1 or $utf8) {
            utf8::upgrade($str);
        }

        if ($idx->[ P_SHRINK ]) {
            utf8::downgrade($str, 1);
        }

        return $str;

script/cpanurl  view on Meta::CPAN


          $addr =~ /0x(\w+)/;
          local $^W;
          #no warnings 'portable';
          hex($1);
        }
    }
}


# shamely copied and modified from JSON::XS code.

$App::cpanurl::JSON::PP::true  = do { bless \(my $dummy = 1), "App::cpanurl::JSON::PP::Boolean" };
$App::cpanurl::JSON::PP::false = do { bless \(my $dummy = 0), "App::cpanurl::JSON::PP::Boolean" };

sub is_bool { defined $_[0] and UNIVERSAL::isa($_[0], "App::cpanurl::JSON::PP::Boolean"); }

sub true  { $App::cpanurl::JSON::PP::true  }
sub false { $App::cpanurl::JSON::PP::false }
sub null  { undef; }



( run in 0.690 second using v1.01-cache-2.11-cpan-05444aca049 )