use List::MoreUtils qw(uniq);
use JSON;
my $json = JSON->new->allow_nonref;
#Alias_Address
has alias_get_uri => ( is => 'ro', default => '/mail/aliases?format=json' );
has alias_add_uri => ( is => '
liases/remove' );
#User_Address
has user_get_uri => ( is => 'ro', default => '/mail/users?format=json');
has user_add_uri => ( is => 'ro', default => '/mail/users/add' );
has user_remove_uri => ( is
e doesn't return JSON for post requests
has '+deserializer' => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
my $usejson = $self->json;
sub {
cript than with C<POST> or
query strings. JavaScript code run on the client can take advantage of
JSON files containing useful data. Updates to the data do not necessarily
have to be performed on the
m_json {
my $class = shift;
my %p = @_;
my $event_pkg = delete $p{__PACKAGE__};
require(pkg_to_file($event_pkg));
if (exists $p{trace}) {
$p{trace} = Test2::Util::Trace->from_json(%
|| []}) {
push @subevents, Test2::Event->from_json(%$subevent);
}
$p{subevents} = \@subevents;
}
return $event_pkg->new(%p);
}
sub TO_JSON {
my $self = shift;
return {%$self, __P
->TO_JSON
This returns a hashref suitable for passing to the C<< Test2::Event->from_json
>> constructor. It is intended for use with the L<JSON> family of modules,
which will look for a C<TO_JSON> me
, $dir, $archive_file ) = @_;
my $guard = pushd( glob("$dir/*") );
for my $mfile ( 'META.json', 'META.yml', 'META.yaml' ) {
next unless -f $mfile;
my $meta = eval { CPAN::Meta
ntext *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL const char *duk_json_encode(duk_context *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL void duk_json_decode(duk_context *ctx, duk_idx_t idx);
DUK_EXTERNAL_DECL
_USE_JSON_BUILTIN
#define DUK_USE_JSON_DECNUMBER_FASTPATH
#define DUK_USE_JSON_DECSTRING_FASTPATH
#define DUK_USE_JSON_DEC_RECLIMIT 1000
#define DUK_USE_JSON_EATWHITE_FASTPATH
#define DUK_USE_JSON_ENC
_RECLIMIT 1000
#define DUK_USE_JSON_QUOTESTRING_FASTPATH
#undef DUK_USE_JSON_STRINGIFY_FASTPATH
#define DUK_USE_JSON_SUPPORT
#define DUK_USE_JX
#define DUK_USE_LEXER_SLIDING_WINDOW
#undef DUK_USE_LIGH
define DUK_USE_NONSTD_FUNC_STMT
#define DUK_USE_NONSTD_GETTER_KEY_ARGUMENT
#define DUK_USE_NONSTD_JSON_ESC_U2028_U2029
#define DUK_USE_NONSTD_SETTER_KEY_ARGUMENT
#define DUK_USE_NONSTD_STRING_FROMCHAR
package Net::Zendesk;
use strict;
use warnings;
use MIME::Base64;
use JSON::MaybeXS;
our $VERSION = '0.02';
sub new {
my ($class, %args) = @_;
die 'please provide a zendesk domain name (e.g.
}, $class;
}
sub create_ticket {
my ($self, $ticket, %extra) = @_;
my $path = 'tickets.json';
if (%extra) {
$path .= '?' . join('&', map("$_=$extra{$_}", keys %extra));
}
I::Escape::uri_escape(join(' ' => @$parsed_args));
return $self->make_request('GET', 'search.json?query=' . $query, {});
}
sub make_request {
my ($self, $type, $path, $params) = @_;
die
}
sub from_json {
my $class = shift;
my %p = @_;
my $trace_pkg = delete $p{__PACKAGE__};
require(pkg_to_file($trace_pkg));
return $trace_pkg->new(%p);
}
sub TO_JSON {
my $se
O_JSON
This returns a hashref suitable for passing to the C<<
Test2::Util::Trace->from_json >> constructor. It is intended for use with the
L<JSON> family of modules, which will look for a C<TO_JSON>
n
C<convert_blessed> is true.
=item $t = Test2::Util::Trace->from_json(%$hashref)
Given the hash of data returned by C<< $t->TO_JSON >>, this method returns a
new trace object of the appropriate sub
warnings;
use Carp;
use Digest::SHA qw(sha256);
use Exporter qw(import);
use HTTP::Message;
use JSON::XS;
use List::Util qw(first);
use LWP::UserAgent;
use MIME::Base64;
use Text::Trim;
use Time::Hi
meout($self->{http_timeout});
$self->{http_agent}->default_header("Content-Type" => "application/json");
$self->{http_agent}->default_header("Accept-Encoding" => $self->{http_compression});
if (!$
} . "/threatListUpdates:fetch?key=" . $self->{key},
"Content-Type" => "application/json",
Content => encode_json($info)
);
$self->{logger} && $self->{logger}->trace($response->request()->as_str
C<json_decode>
see L<http://duktape.org/api.html#duk_json_decode>
=cut
*json_decode = \&aperl_duk_json_decode;
=item C<json_encode>
see L<http://duktape.org/api.html#duk_json_encode>
=cut
*json_e
ncode = \&aperl_duk_json_encode;
=item C<load_function>
see L<http://duktape.org/api.html#duk_load_function>
=cut
*load_function = \&aperl_duk_load_function;
=item C<map_string>
see L<http://dukt
';
use JSON;
use LWP::Protocol::Net::Curl;
use LWP::UserAgent;
use URI;
use URI::QueryParam;
use URI::Escape;
use Carp;
use Data::Dump 'dump';
# the following GET parameter keys have to be JSON encod
ed according to the
# couchDB API documentation. http://docs.couchdb.org/en/latest/api/
my @JSON_KEYS = qw(
doc_ids
key
keys
startkey
start_key
endkey
end_key
);
has 'deb
=> sub { 30 },
);
has 'json' => (
is => 'rw',
isa =>
sub { JSON->new->utf8->allow_nonref->allow_blessed->convert_blessed },
default => sub {
JSON->new->utf8->allow_nonref
}
elsif ( $format =~ /^json([0-3])?$/ ) {
require JSON;
my $json = JSON->new();
if ( !defined($1) || $1 == 1 || $1 == 3 ) {
$json->pretty();
}
if ( !defined($1) || $1 == 2 || $1 == 3 ) {
$json->canonical(1);
}
$string = $json->encode($config);
}
else {
$self->usage_error("unsupported format [$form
fpl config project
fpl config project.environment
fpl config project.environment --format json2
fpl config project --format dumper3
=head1 DESCRIPTION
Prints out the config at the specifie
e Carp qw(confess);
use JSON;
use LWP::UserAgent;
use List::MoreUtils qw(uniq);
sub get_user {
my $username = shift;
my $ua = LWP::UserAgent->new;
my $get_json =
$ua->get("https:
t_json->is_success ) {
my $raw_json = $get_json->decoded_content;
my $dec_json = decode_json $raw_json;
my @push_events = grep { $_->{type} eq 'PushEvent' } @{$dec_json};
code_utf8);
use WebService::Slack::WebApi;
use Log::Dispatch::Output;
use Try::Tiny;
use JSON::XS qw/decode_json/;
use base qw( Log::Dispatch::Output );
use Params::Validate qw(validate SCALAR BOOLE
:Session->new(
#required
on_send => sub { ... },
#optional; default is 'json'
serialization => 'msgpack',
);
=head1 DISCUSSION
The only thing externally documen
------------------
package main;
my $client = My_Client->new(
serialization => 'json',
#Output this way:
on_send => sub {
my $serialized_bytes = shift;
t
layer (e.g., WebSocket, RawSocket, …) you’re using.
=item * C<serialization> (optional): C<json> is the default; C<msgpack>
is also an option.
=back
=head2 I<OBJ>->send_HELLO( REALM, AUXILIAR
speak raw TCP.
=head1 SERIALIZATIONS
WAMP defines two serializations officially: L<JSON|http://json.org>
(C<json>)
and L<MessagePack|http://msgpack.org> (C<msgpack>).
Note that MessagePack is a bi
pack 'CS>/a*', 0xDA, $v if $len <= 0xFFFF;
return pack 'CL>/a*', 0xDB, $v;
}
sub TO_JSON {
my ($self) = @_;
return $$self;
}
=head1 NAME
DR::Tnt::Msgpack::Types::Str - containe
ack 'CS>/a*', 0xC5, $v if $len <= 0xFFFF;
return pack 'CL>/a*', 0xC6, $v;
}
sub TO_JSON {
my ($self) = @_;
return $$self;
}
=head1 NAME
DR::Tnt::Msgpack::Types::Blob - contain
#default
);
#msgpack is also accepted
$rs->send_handshake(
serialization => 'json', #default
);
$rs->verify_handshake();
$rs->send_message('This is a message.);
his when your read timeout expires to send a PING message.
=head2 I<OBJ>->get_serialization()
C<json> or C<msgpack>.
=head2 I<OBJ>->get_max_send_length()
The maximum bytes that the connection’s
b TO_JSON {
my ($self) = @_;
state ($true, $false);
unless (defined $true) {
if (eval "require JSON::XS; 1") {
$true = JSON::XS::true();
$false = JSON::XS
();
} elsif (eval "require JSON; 1") {
$true = JSON::true();
$false = JSON::false();
} else {
croak "JSON or JSON::XS must be installed";
}