use JSON ();
ZMQ::register_read_type(json => \&JSON::decode_json);
ZMQ::register_write_type(json => \&JSON::encode_json);
my $sock = $ctx->socket( ... );
$sock->sendmsg_as( json =>
$payload );
my $payload = $sock->recvmsg_as( 'json' );
=head1 DESCRIPTION
You can add a simple serialization/deserialization mechanism to ZMQ by enabling this module.
To enable serialization, y
le, for JSON we do
the following (this is already done for you in ZMQ.pm if you have
JSON.pm installed):
use JSON ();
ZMQ::Serializer::register_write_type('json' => \&JSON::encode_json);
(@_)
);
}
sub value {
defined $_[0][1] ? $_[0][1] : ($_[0][1] = desurrogify($_[0][0]));
}
*TO_JSON=*value;
sub value16 {
defined $_[0][0] ? $_[0][0] : ($_[0][0] = surrogify($_[0][1]));
}
sub t
have overloaded operators)
=item -
The JavaScript datatypes provide C<TO_JSON> methods for compatibility with
L<JSON.pm|JSON>.
=back
JE's greatest weakness is that it's slow (well, what did you ex
an.
=cut
#use Carp;
sub new { bless \do{my $thing = $_[1]}, $_[0] }
sub value { undef }
*TO_JSON=*value;
sub typeof { 'object' }
sub id { 'null' }
sub primitive { 1 }
sub to_primitive { $_[0
lf.
=cut
sub value {
my $self = shift;
+{ map +($_ => $self->prop($_)), $self->keys };
}
*TO_JSON=*value;
sub id {
refaddr shift;
}
sub primitive { !1 };
sub prototype {
@_ > 1 ? (${+shif
Number')->prop(shift)->apply(
$self,$$self[1]->upgrade(@_)
);
}
sub value {
shift->[0]
}
*TO_JSON=*value;
sub exists { !1 }
sub typeof { 'number' }
sub class { 'Number' }
sub id {
ugh which you can modify the
object, use C<@$a>.
=cut
sub value { [@{$${+shift}{array}}] };
*TO_JSON=*value;
sub exists {
my ($self, $name) = (shift, @_);
my $guts = $$self;
if ($name eq 'len
x' => 1,
}
],
qw(
License
ModuleBuildTiny
MakeMaker::Fallback
),
qw(
MetaYAML
MetaJSON
InstallGuide
DOAP
Covenant
CPANFile
),
);
# ; -- special stuff for README files
# we
] ; create Makefile.PL file for older Perls
[MetaYAML] ; create META.yml file
[MetaJSON] ; create META.json file
[ReadmeAnyFromPod] ; create README file
[ReadmeAnyFromPod / PodRoot] ; create
check for metadata dependencies
use Test::More;
use File::Slurp 9999.13;
use YAML::Any 0.72;
use JSON::Any 1.25;
use File::Find::Rule 0.32;
use Perl::PrereqScanner 1.000;
use Test::Deep 0.108;
use CP
a
my $runtime_req;
my $test_req;
my $provides;
if ( -e 'META.json' ) {
my $file = read_file( 'META.json' );
my $metadata = JSON::Any->new->Load( $file );
$runtime_req = $metadata->{'prereqs'
$provides = $metadata->{'provides'} if exists $metadata->{'provides'};
} else {
die 'No META.(json|yml) found!';
}
# Okay, scan the files
my $found_runtime = CPAN::Meta::Requirements->new;
my
= '0.001';
our $AUTHORITY = 'cpan:APOCAL';
# ABSTRACT: Add a Bitbucket repo's info to META.{yml,json}
use Moose;
extends 'Dist::Zilla::Plugin::Bitbucket';
with 'Dist::Zilla::Role::MetaProvider';
ata
=head1 NAME
Dist::Zilla::Plugin::Bitbucket::Meta - Add a Bitbucket repo's info to META.{yml,json}
=head1 VERSION
This document describes v0.001 of Dist::Zilla::Plugin::Bitbucket::Meta - rele
illa> plugin adds some information about the distribution's Bitbucket
repository to the META.{yml,json} files, using the official L<CPAN::Meta>
specification.
This module currently sets the following
ints;
use HTTP::Tiny 0.050;
use Try::Tiny 0.22;
use MIME::Base64 3.14;
use JSON::MaybeXS 1.002006 qw( encode_json decode_json );
use Git::Wrapper 0.037;
use File::pushd 1.009;
extends 'Dist::Zilla::P
c " . MIME::Base64::encode_base64("$login:$pass", '');
$headers->{'content-type'} = "application/json";
# We use the v2.0 API to create
my $url = 'https://api.bitbucket.org/2.0/repositories/' . $l
ository '%s'", $repo_name ]);
my $response = $http->request( 'POST', $url, {
content => encode_json( $params ),
headers => $headers
});
if ( ! $response->{'success'} ) {
$self->log( ["Error:
=> 1;
use Try::Tiny qw/try catch/;
use Plack::Request;
use Params::Validate;
use JSON::XS qw/decode_json encode_json/;
use Convert::Base32 qw/encode_base32/;
use Net::OATH::Server::Lite::Error;
use
s ($request->method eq q{POST});
# content MUST be JSON
my $content = {};
eval {
$content = decode_json($request->content) if $request->content;
};
Content-Type" => "application/json;charset=UTF-8",
"Cache-Control" => "no-store",
"Pragma" => "no-cache" ],
[ encode_json($params) ]);
} catch {
=> 1;
use Try::Tiny qw/try catch/;
use Plack::Request;
use Params::Validate;
use JSON::XS qw/decode_json encode_json/;
use Net::OATH::Server::Lite::Login;
use Net::OATH::Server::Lite::Error;
sub n
s ($request->method eq q{POST});
my $params;
eval {
$params = decode_json($request->content);
};
Net::OATH::Server::Lite::Error->throw() unless $params;
t-Type" => "application/json;charset=UTF-8",
"Cache-Control" => "no-store",
"Pragma" => "no-cache" ],
[ encode_json($response_params) ]);
'SIGNATURE' ) {
push( @files, 'SIGNATURE' );
}
# check META.json if it's there
if ( -e 'META.json' ) {
push( @files, 'META.json' );
}
plan tests => ( ( scalar @files ) * 4 ) + ( ( scalar @p
JSON string that can be passed to
VM::EC2->get_federation_token(), or other AWS libraries.
=head1 STRING OVERLOADING
When used in a string context, this object will interpolate into the
policy JSON
text. In addition,
please see DISCLAIMER.txt for disclaimers of warranty.
=cut
use strict;
use JSON;
use VM::EC2;
use Carp 'croak';
use overload
'""' => 'as_string',
fallback => 1;
su
cal $self->{statements};
$self->deny('*');
return $self->as_string;
}
my $json = JSON->new();
$json->canonical(1);
return $json->encode({Statement => \@list});
}
1;
dJSON;
$Limper::SendJSON::VERSION = '0.003';
use base 'Limper';
use 5.10.0;
use strict;
use warnings;
package # newline because Dist::Zilla::Plugin::PkgVersion and PAUSE indexer
Limper;
use JSON:
push @Limper::EXPORT, qw/send_json/;
sub send_json {
my ($data, @options) = @_;
response->{headers}{'Content-Type'} //= 'application/json';
try {
JSON::MaybeXS->new(@options)->enc
or Pod::Coverage
=head1 NAME
Limper::SendJSON - adds a send_json function to Limper
=head1 VERSION
version 0.003
=head1 SYNOPSIS
use Limper::SendJSON;
use Limper; # this must come after al
ur $VERSION = '0.07';
use Config;
use URI::Escape qw(uri_escape);
use LWP::UserAgent;
use JSON qw(decode_json);
use CPAN::DistnameInfo;
use List::Util qw(sum);
our $SERVER = "http://grep.cpan.me";
o
ngth($content) . " bytes");
my $result = eval { decode_json($content) };
if ($@ or not $result) {
warn "Error decoding JSON response: $@\n";
debug($content);
return;
Same thing, faster to type.
-policy A VM::EC2::Security::Policy object, or a JSON string
complying with the IAM policy syntax.
The duration must be no shorte
AWSEC2/latest/UserGuide/UsingIAM.html.
Note that these routines require installation of the perl JSON module, and will
cause a fatal error if this module cannot be loaded.
iam_info --
{/^\d+=(.+)/ && $1} @keys;
}
sub iam_info {
my $self = shift;
$self->_load_json;
return JSON::from_json($self->fetch('iam/info'));
}
sub iam_role {
my $self = shift;
return $self
_from_json');
return VM::EC2::Security::Credentials->new_from_json($data,$self->endpoint);
}
sub _load_json {
return if JSON->can('decode');
eval "require JSON; 1" or croak "no JSON modul
CacheDNS ':register';
use HTTP::Request::Common;
use VM::EC2::Error;
use Carp 'croak','carp';
use JSON;
our $VERSION = '1.28';
our $AUTOLOAD;
our @CARP_NOT = qw(VM::EC2::Image VM::EC2::Volume
ndpoint?" . join '&', @param;
my $response = $self->ua->request($request);
return JSON::decode_json($response->content);
}
=head2 $url = $ec2->login_url(-credentials => $credentials, -issue