ead1 DESCRIPTION
=cut
use Future;
use Future::Utils qw(try_repeat);
use POSIX qw(strftime);
use JSON::MaybeXS;
use Scalar::Util qw(reftype);
use B qw(svref_2object);
use HTTP::Request;
use WebServi
cess_key} }
sub secret_key { shift->{secret_key} }
sub api_version { '20120810' }
sub json { shift->{json} //= JSON::MaybeXS->new }
=head2 security_token
=cut
sub security_token { shift->{security_
(
# Sadly not the same key as used in DeleteTable
done => sub { my $content = shift; $self->json->decode($content)->{Table}; }
);
})
}
=head2 delete_table
Delete a table entirely.
Takes a
Moose;
use URI;
use URI::QueryParam;
use WWW::GoDaddy::REST::Util qw( abs_url json_instance json_encode json_decode is_json );
use constant DEFAULT_IMPL_CLASS => 'WWW::GoDaddy::REST::Resource';
use o
rt ) ) || DEFAULT_IMPL_CLASS;
eval "require $impl;";
}
else {
# hmm, the json response didn't seem to be a hashref...
# well in this case, there are not really any fie
# content
$params->{fields} = {};
}
return $impl->new($params);
}
sub TO_JSON {
my $self = shift;
return $self->data;
}
sub data {
my $self = shift;
my %fiel
cut
sub make_request {
my $self = shift;
my %args = @_;
my $target = $args{target};
my $js = JSON::MaybeXS->new;
my $req = HTTP::Request->new(
POST => $self->uri
);
$req->header( host => $se
namoDB_'. $self->api_version. '.'. $target );
$req->header( 'content-type' => 'application/x-amz-json-1.0' );
my $payload = $js->encode($args{payload});
$req->content($payload);
$req->header( 'Con
{
my( $store, $path, $value ) = @_;
if ( $path =~ m#^json# ) {
return encode_json($value);
}
else {
# defaults to YAML
my( $store, $path, $value ) = @_;
return $path =~ m#^json#
? encode_json($value)
: YAML::Dump($value)
( $store, $path, $value ) = @_;
return $path =~ #^json#
?decode_json($value)
: YAML::Load($value)
rveymonkey API client
use 5.010;
use strict;
use warnings;
use utf8;
use Mouse;
use Carp;
use JSON;
use LWP::UserAgent;
use Log::Any '$log';
use File::Slurp;
use List::Util qw/first/;
our $SM_AP
f->key();
my $payload = encode_json $data;
my %header = (
"Authorization" => "bearer " . $self->token(),
"Content-Type" => "application/json",
);
$log->trace("Call:
tent();
$log->trace("Response: $resp_content") if $log->is_trace();
my $result = decode_json $resp_content;
croak "SM API call failed: $result->{errmsg}" if $result->{status};
ret
r_value
Returns an appropriate type (N, S, SS etc.) for the given
value.
Rules are similar to L<JSON> - if you want numeric, numify (0+$value),
otherwise you'll get a string.
=head2 type_and_value
WW::GoDaddy::REST::Shell::Util qw(get_resource_by_schema_or_uri);
use WWW::GoDaddy::REST::Util qw(json_encode);
sub run_docs {
my $self = shift;
my $usage = "Usage:\n docs [schema] [id]\n do
[ map {" $_"} keys %fields ],
[ map {
if ( ref($_) ) { json_encode($_) }
else {$_}
} values %fields
ngs;
use JSON qw();
use Sub::Exporter -setup => {
exports => [
qw( abs_url
add_filters_to_url
build_complex_query_url
is_json
json_decode
json_encode
json_instance
)
]
};
use URI;
use URI::QueryParam;
sub is_json {
my $json = shift;
my $handler = json_instance(@_);
eval { my $perl = json_d
ecode($json); };
if ($@) {
return 0;
}
else {
return 1;
}
}
sub json_encode {
my $perl = shift;
my $handler = json_instance(@_);
return $handler->encode
ChromeLogger;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::ByteStream qw/b/;
use Mojo::JSON qw/encode_json/;
our $VERSION = 0.06;
has logs => sub { return [] };
my %types_map = (
'debug' =>
h @$rows, [[ $main_group ], undef, 'groupEnd'];
my $json = encode_json($data);
my $final_data = b($json)->b64_encode('');
$c->res->headers->add( 'X-ChromeLo
, stash, session and config to Google Chrome console. Works with all types of responses(including JSON).
To view logs in Google Chrome you should install ChromeLogger extenstion. Logging works only in
ncer::Plugin::Xslate->load({
'function' => {
'encode_json' => sub {
return JSON::encode_json(@_);
}
}
});
The second way is to the optional
strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
errors => [
map {;
my @cols = map $_->as
],
exception => $cols[1],
message => $cols[2],
cause => $cols[3],
retry => $cols[4] eq 'Y' ? JSON->true : JSON->false,
}
} @rows
]
});
Future->wrap;
})->get;
e 5.006;
use strict;
use warnings;
use AWS::Signature4;
use Carp;
use HTTP::Request::Common;
use JSON;
use LWP;
use Params::Validate qw( :all );
use Readonly;
#use Smart::Comments '###';
#use Smart::
I version
$self->{api_version} = $API_VERSION;
# for parsing the responses
$self->{js} = JSON->new->allow_nonref;
# store a request signer for later
$self->{signer} = AWS::Signature4->
" );
return undef;
}
else {
$args{params}{Version} = $self->{api_version};
}
# JSON encode the params
my( $js ) = $self->{js}->encode( $args{params} );
### $js
# set custom
, stash, session and config to Google Chrome console. Works with all types of responses(including JSON).
To view logs in Google Chrome you should install ChromeLogger extenstion. Logging works only in
Tickit::TabRibbon;
use App::mirai::Tickit::Widget::Logo;
use Future;
use POSIX qw(strftime);
use JSON::MaybeXS;
use File::Spec;
my %widget;
sub user_path { File::Spec->catpath($_[0]->{user_path}, $
left lines cols)
]
};
}
open my $fh, '>', $sp or die $!;
$fh->print(encode_json($session));
};
menuitem 'Save session as...' => sub { warn 'save as' };
menuspacer;
m
open my $fh, '<', $path or die "Unable to open last session $path - $!";
my $session = decode_json(do { local $/; <$fh> });
tickit->later(sub {
my @win = @{$widget{desktop}->{widgets}};
fo
strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
regions => [
map {;
my @cols = map $_->a
lp::Model -api => 1;
...
This will tell Pulp to do all the work for you, and generates a basic JSON API.
Some of the commands are below:
=head3 list
Lists all rows found for a particular resultse
n::DateTime>
=head3 L<DBIx::Class::InflateColumn::Serializer>
Very useful in combination with L<JSON> to get a simple random data storage
field.
=head3 L<DBIx::Class::EncodedColumn::Crypt::Eksblow
a crash more useful, show a stack trace.
=head3 L<Catalyst::View::TT>
=head3 L<Catalyst::View::JSON>
=head3 L<Catalyst::View::Email::Template>
=head3 L<Yeb>
A very simple straightforward Web DSL
Duration>
A good way to display a time duration to humans.
=head3 L<JSON>
The most effective data storage way ...
=head3 L<JSON::MaybeXS>
... and make it quick!
=head3 L<YAML>
If you want the d
strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
errors => [
map {;
my @cols = map $_->as
],
exception => $cols[1],
message => $cols[2],
cause => $cols[3],
retry => $cols[4] eq 'Y' ? JSON->true : JSON->false,
}
} @rows
]
});
Future->wrap;
})->get;
eal> if available, will fall back to JSON via L<JSON::MaybeXS>. Set
C< MIRAI_SERIALISATION > in the environment to override:
=over 4
=item * Sereal
=item * JSON
=back
=cut
use constant SERIALISA
TION => $ENV{MIRAI_SERIALISATION} || (eval { require Sereal } ? 'Sereal' : 'JSON');
use Socket qw(AF_UNIX SOCK_STREAM PF_UNSPEC);
use IO::Handle;
# Everything after this point should happen at
# run
y $line = <$child_read>;
# $child_read->close or die $!;
my $encoder = SERIALISATION eq 'JSON' ? JSON::MaybeXS->new(utf8 => 1) : Sereal::Encoder->new;
App::mirai::Subprocess->setup(sub {
eva
strict;
use warnings;
use IO::Async;
use Net::Async::HTTP;
use HTML::TreeBuilder qw(-weak);
use JSON::MaybeXS;
my $loop = IO::Async::Loop->new;
$loop->add(
my $ua = Net::Async::HTTP->new(
fail_o
> 'tbody'), $ddb;
binmode STDOUT, ':encoding(UTF-8)';
my $json = JSON::MaybeXS->new(
pretty => 1,
canonical => 1,
);
print $json->encode({
regions => [
map {;
my @cols = map $_->a