package Mojolicious::Plugin::Args;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::JSON 'decode_json';
sub register {
my ( $self, $app, $opts ) = @_;
$opts->{ '-want-detail' } //= 0 unless ex
n/json' ) or
( $c->req->method eq 'GET' and defined $stash->{format} and $stash->{format} eq 'json' and defined $args{json} ) ) {
my @args = keys %args;
my $json =
decode_json( $c->req->method eq 'GET' ? delete $args{json} : $c->req->body );
my @json = keys %{ $json };
do {
$args{__args}->{ $_ } = $args{ $_ } for @args;
EF
push @INC, '/', @base;
};
use parent qw { CHEF CHEF::Header };
use LWP::UserAgent;
use Mojo::JSON;
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
bless $self, $class;
);
return $response;
}
sub post
{
my $self = shift;
my $param = {@_};
my $mojo_json = new Mojo::JSON();
my $response = $self->add_headers(
$self->header(
'Path' => $param->{'api_end_point'},
'Content' => $mojo_json->encode($param->{'data'})
)->hash
)
;
use warnings;
# PODNAME: wtscript2json
# ABSTRACT: convert read configuration into JSON
use v5.10.1;
use File::Slurp qw(write_file);
use Getopt::Long;
use JSON ();
use List::MoreUtils qw(zip);
us
opts{"input-files"} }, @{ $opts{"output-files"} } )
: ();
my %cfg = load_config();
my $coder = JSON->new();
_ARRAY( $cfg{wtscript_extensions} )
and Config::Any::WTScript->extensions( @{ $cfg{wtsc
t and previous loaded config ...
my $json = $coder->pretty->encode( $scripts->{ $script_files[0] } );
write_file( $in2out{$filename}, $json );
}
else
{
while ( my (
se Getopt::Long qw(:config posix_default no_ignore_case);
use Pod::Usage;
use Mojo::JSON qw(decode_json encode_json);
use Mojo::URL;
use Mojo::UserAgent;
use Mojo::UserAgent::CookieJar;
use Data::Du
$param->{$k} = $v;
}
return $param;
}
#### Zimbra Manager Communication ###
sub getJSONZimbraManager {
my $function = shift;
my $params = shift;
my $catcherr = shift;
n);
$url->query($params);
my $req = $ua->get($url);
return processJSONAnswer($req, $catcherr);
}
sub postJSONZimbraManager {
my $function = shift;
my $params = shift;
my $c
Client::attributes;
$CHEF::REST::Client::roles::VERSION = 1.0;
# this module will be passed tha json parsed hash
# under ___data__() or variable.
# process it depending on the content expected.
su
:CRUD::Object );
# help for serialize()
use Rose::DB::Object::Helpers qw( column_values_as_json );
use JSON;
our $VERSION = '0.302';
=head1 NAME
CatalystX::CRUD::Object::RDBO - Rose::DB::Object im
DateTime
et al objects serialized to strings.
=cut
sub serialize {
return decode_json( column_values_as_json( shift->delegate ) );
}
1;
__END__
=head1 AUTHOR
Peter Karman, C<< <karman at cpa
=item -
qw(check_host_app_one)
=item -
qw(check_host/app_one)
=item -
qw(check_host_app_one.json)
=item -
qw(check_host/app_one.yml)
=item -
qw(check_splunk_[1-5])
=item -
qw(splunk/test*)
t all the cookbooks available.
$obj->cookbook()->list;
=cut
# this module will be passed tha json parsed hash
# under ___data__() or variable.
# process it depending on the content expected.
su
*to_string = \&value;
sub get_time {
return hex(substr($_[0]->{value}, 0, 8));
}
sub TO_JSON { {'$oid' => $_[0]->{value}} }
use overload
'""' => \&to_string,
'fallback' => 1;
1;
he timestamp.
=head2 TO_JSON
my $json = JSON->new;
$json->allow_blessed;
$json->convert_blessed;
$json->encode(MongoDB::Async::OID->new);
Returns a JSON string for this OID. Thi
s is compatible with the strict JSON
representation used by MongoDB, that is, an OID with the value
"012345678901234567890123" will be represented as
C<{"$oid" : "012345678901234567890123"}>.
=head
ZimbraManager;
use Mojo::Base 'Mojolicious';
use Mojo::Util qw(dumper);
use Mojo::JSON qw(decode_json encode_json);
use ZimbraManager::SOAP;
use ZimbraManager::SOAP::Friendly;
use HTTP::CookieJar
$ctrl->render(text => "<pre>$text</pre>") if ($plain);
}
else {
$ctrl->render(json => $text);
}
};
my $buildAuthRequest = sub {
my $user = shift;
my $password = shi
g
$r->post('/auth' => sub {
my $ctrl = shift;
my $perl_args = decode_json($ctrl->req->body);
my $user = $perl_args->{'user'};
my $password = $per
ection in your main file in your distribution, this L<Dist::Zilla>
plugin will populate your META.json x_contributors list from it.
The format should be:
Some Name <some@email.com>
nicknames are
irname(__FILE__) ) ) );
pop @base; #REST
pop @base; #CHEF
push @INC, '/', @base;
};
use Mojo::JSON;
sub new {
my $class = shift;
my $param = {@_};
my $self = {};
bless $self, $class;
b ___data___
{
my $self = shift;
my $result = shift;
my $mojo_json = new Mojo::JSON();
$self->{'___data___'} =
$mojo_json->decode( $result )
if defined $result;
=> $violation->explanation,
diagnostics => $violation->diagnostics,
};
}
$self->render( json => \@results );
}
sub _capture_cmd_output {
my $self = shift;
my $cmd = shift;
my $opts
aram('input');
my $o = $self->_capture_cmd_output( $^X, [], $source, $input );
$self->render( json => $o );
}
sub run_perlbrew_exec {
my $self = shift;
my $source = $self->param('source');
m
$self->_capture_cmd_output( 'perlbrew', [ 'exec', 'perl' ],
$source, $input );
$self->render( json => $o );
}
# Taken from Padre::Plugin::PerlTidy
# TODO document it in 'SEE ALSO' POD section
sub
ode => $code);
$expected_response->set_body(
text => $self->{'registry'}->get_json()->encode(
reference => $body));
is(
$response->get_text(),
package Exobrain::JSONify;
use Moose::Role;
use Storable qw(dclone);
use Data::Structure::Util qw(unbless);
# Basic role that allows converting self object into JSON.
# Really we should use MooseX::S
sub TO_JSON {
my ($self) = @_;
return unbless dclone $self; # Yuck!
}
1;
__END__
=pod
=head1 NAME
Exobrain::JSONify
=head1 VERSION
version 1.08
=for Pod::Coverage TO_JSON
=head1
st::Psgi;
use parent qw(Eve::HttpRequest);
use strict;
use warnings;
use Hash::MultiValue;
use JSON::XS;
use Plack::Request;
=head1 NAME
B<Eve::HttpRequest::Psgi> - an HTTP request adapter for th
t_type() eq 'application/json') {
$self->_body_parameters = Hash::MultiValue->new(
%{$self->cgi->query_parameters()->as_hashref_mixed()},
%{JSON::XS->new()->utf8()->dec
Constraints;
use Carp;
use ZMQ::Constants qw(ZMQ_SNDMORE);
use ZMQ;
use JSON::Any;
use Data::Dumper;
use Exobrain::Types qw(JSON);
# ABSTRACT: Top-level role for all exobrain messages
our $VERSION =
# data.
requires qw(summary);
# TODO: We should use JSON::XS, because we need specialised features
# for handling objects.
my $json = JSON::Any->new( convert_blessed => 1 );
# We define a du
s;
push(@frames, join("_", "EXOBRAIN", $self->namespace, $self->source));
push(@frames, $json->encode( {
timestamp => $self->timestamp,
roles => $self->roles,
# TO
::Declare::ZDCF::Encoder>.
Implements an encoder/decoder using Data::Dumper and eval.
Prefer the JSON encoder unless you have no choice -- this one can execute
arbitrary input code thanks to the eval
f->component );
}
has json => (
is => 'ro',
lazy => 1,
builder => '_build_json',
);
method _build_json() {
eval "use JSON::Any; 1;" or die $@;
return JSON::Any->new;
}
1;
__EN
<Exobrain::Cache> object, with a namespace of
C<$self->component>.
=head2 json
my $json = $self->json;
Returns a L<JSON::Any> object.
=head1 AUTHOR
Paul Fenwick <pjf@cpan.org>
=head1 COPYRIG
N
Inherits from
L<ZMQ::Declare::ZDCF::Encoder>.
Implements a Storable encoder/decoder. Use the JSON encoder instead unless
you absolutely require Storable.
=head1 SEE ALSO
The ZDCF RFC L<http://r
rg/spec:5>
L<ZMQ::Declare::ZDCF>
L<ZMQ::Declare::ZDCF::Encoder>,
L<ZMQ::Declare::ZDCF::Encoder::JSON>
L<ZeroMQ>
=head1 AUTHOR
Steffen Mueller E<lt>smueller@cpan.orgE<gt>
=head1 COPYRIGHT AND LIC