expression syntax, but is intended
to have language-independent use. It is similar in spirit to JSON, which
is based on JavaScript, but Pond represents fewer data types directly.
The data that can
die "Pond data error: unsupported data type\n";
}
}
=back
=head1 SEE ALSO
L<Data::Dumper>,
L<JSON::XS>,
L<perlfunc/eval>
=head1 AUTHOR
Andrew Main (Zefram) <zefram@fysh.org>
=head1 COPYRIGHT
tf8 YAML::PP::Dump($content);
}
elsif ($format eq 'JSON') {
require JSON::XS;
my $coder = JSON::XS->new->ascii->pretty->allow_nonref;
$content = enc
s called by L<App::Spec::Run> right before output.
=back
=cut
__DATA__
---
- name: format
summary: Format output
type: string
enum: [JSON, YAML, Table, "Data::Dumper", "Data::Dump"]
le' => [
# and so the exports of this module:
'Data::Roundtrip' => [qw/perl2json json2perl/],
],
},
'processors' => {
# if it includes other in-memory t
ully
# qualified sub names '::')
'module' => [
'Data::Roundtrip' => [qw/perl2json json2perl/],
],
...
},
=back
=back
The constructor returns C<undef> on fai
t has stored in it in JSON format:
perl -MPDL::Doc -MJSON::PP -e \
'print encode_json +PDL::Doc->new(PDL::Doc::_find_inc([qw(PDL pdldoc.db)]))->gethash' |
json_pp -json_opt pretty,canonical
r other languages aren't much to go on. They are barely more than a small wrapper around HTTP and JSON encoding/decoding. I have tried to do better.
=head1 METHODS
=head2 secret
my $secret = $vaul
ut;
# ABSTRACT: an object representing an RST input parameter.
use base qw(ICANN::RST::Base);
use JSON::Schema;
use strict;
sub description { ICANN::RST::Text->new($_[0]->{'Description'}) }
sub type
chema { $_[0]->{'Schema'} ? JSON::Schema->new(numify($_[0]->{'Schema'})) : undef }
sub required { exists($_[0]->{'Required'}) && $_[0]->{'Required'} }
sub jsonExample {
my $self = shift;
ify($value));
}
return \@array;
}
sub numify_scalar {
my $value = shift;
if (q{JSON::PP::Boolean} ne ref($value) && $value =~ /^\d+\.?\d*$/) {
$value += 0;
}
return
correct,
but cannot now be changed due to backward compatibility.
=for example
use JSON;
my $json = encode_json unpdl $pdl;
=for bad
unpdl converts any bad values into the string 'BAD'.
=cut
=
IPinfo has an C<sprintf>-style formatting
code, and for everything else you can use C<%j> to get JSON that you can
format with B<jq> for some other tool.
=over 4
=item * C<%a> - the ASN of the orga
the hostname for the IP address
=item * C<%i> - the IP address
=item * C<%j> - all the data as JSON, in a UTF-8 decoded string
=item * C<%k> - the continent of the organization
=item * C<%L> - th
=> sub ( $w, $v, $V, $l ) {
use JSON;
# we decode UTF-8 because it will be encoded again on the
# way out
decode( 'UTF-8', encode_json($V->[0]->TO_JSON) );
},
k => sub ( $w, $v, $V
/schema.yaml";
my $pm = "$Bin/../lib/App/Spec/Schema.pm";
my $yp = YAML::PP->new( schema => [qw/ JSON /] );
my $SCHEMA = $yp->load_file($specfile);
local $Data::Dumper::Sortkeys = 1;
local $Data::Du
# Add dynamic prereqs to the included modules list (if we can)
my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
if ( $source && $HAS_CPAN_META ) {
if ( my $meta = eval { CPAN::Meta->load_fi
if $resp->{lease_id};
$self->{renewable} = 0 + $resp->{renewable} # convert from JSON::Boolean
if $resp->{renewable};
}
}
sub _mkuri {
my $self = shift;
my @p
l
# use 5.010;
# use strict;
# use warnings;
# use feature 'say';
use YAML::XS qw(LoadFile);
use JSON::XS;
use Data::Dumper::Concise;
use Getopt::Long;
use File::Basename;
# use FindBin; # path to
ile to analyze (default: aliases.yml)
--format -t FORMAT Explicitly specify format: YAML or JSON
(default: auto-detect from file extension)
--debug, -d Enab
x =~ /^(ya?ml)$/i ) {
$format = 'YAML';
}
elsif ( $suffix =~ /^(json|jsn)$/i ) {
$format = 'JSON';
}
else {
die
"Unable to determine file format from extension:
JSON::MaybeXS;
$encoder = JSON::MaybeXS->new(allow_tags => 1);
my $ndarray = xvals (5,2);
my $encoded_json = $encoder->encode ($ndarray);
my $decoded_ndarray = $encoder->decode ($encoded_json
);
=head1 DESCRIPTION
Serialisation packages such as C<Storable>, C<Sereal>, C<JSON::MaybeXS>
and C<CBOR::XS> implement
object persistence for Perl data structures that can
contain arbitrary Perl ob
as packages that support
the L<Types::Serialiser> protocol (currently L<Sereal>, L<CBOR::XS> and JSON packages).
Note that packages supporting the C<Types::Serialiser> protocol need to have their
re
use overload fallback => 1;
sub cplx { bless &Math::Complex::cplx, __PACKAGE__ }
# needed for JSON serialisation
sub FREEZE {
my ($self, $serialiser) = @_;
return %$self;
}
sub THAW {
t has stored in it in JSON format:
perl -MPDL::Doc -MJSON::PP -e \
'print encode_json +PDL::Doc->new(PDL::Doc::_find_inc([qw(PDL pdldoc.db)]))->gethash' |
json_pp -json_opt pretty,canonical
return 'false';
} else {
return _to_toml($$_, $param);
}
}
if ($ref eq 'JSON::PP::Boolean') {
return $$data ? 'true' : 'false';
}
if ($ref eq 'Types::Serializer::Boo
ll produce a file that can be read by a "bad" JSON::PP
return if $self->zilla->distmeta->{dynamic_config};
# see https://github.com/makamaka/JSON-PP/pull/9 for for details
$self->log('War
ning: distribution has non-ascii characters in contributor names. META.json will be unparsable on perls <= 5.8.6 when JSON::PP is lower than 2.27300');
$self->zilla->register_prereqs(
{
phase => 'configure',
type => 'suggests',
},
'JSON::PP' => '2.27300',
);
}
# should not be called before the MetaProvider phase
has _contributors => (
ad4 array
=over
=item C<ARRAY> ref
=back
=head4 boolean
=over
=item C<\0> or C<\1>
=item L<JSON::PP::Boolean>
=item L<Types::Serializer::Boolean>
=back
=head4 numeric types
These are tricky
D_RE $SYSV_SUPPORTED $SEMOP_ARGS @EXPORT_OK %EXPORT_TAGS $N $SHEM_REPO );
use Config;
use JSON ();
use Scalar::Util ();
use constant SHM_BUFSIZ => 65536;
use constant SEM_LOCK
buffer, 0, 1 );
my $j = JSON->new->utf8->relaxed->allow_nonref;
my $data;
local $@;
# try-catch
eval
{
# Does the value have any typical json format? " for a string, {
data = $buffer;
}
};
if( $@ )
{
$self->error( "An error occured while json decoding data: $@", ( length( $buffer ) <= 1024 ? "\nData is: '$buffer'" : '' ) );
# Mayb
Alternative configurations are commented out in the script:
# my $alias_file_path = 'aliases.json';
# my $alias_file_path = 'good_aliases.yml';
=head2 Aliases File Format
The aliases file sho