try sync subcommand
our $VERSION = '0.012'; # VERSION
use Pantry::App -command;
use autodie;
use JSON 2;
use Storable qw/dclone/;
use Net::OpenSSH;
use Path::Class;
use Pantry::Model::Util qw/merge_h
# prepare node JSON for upload
# XXX should really check to be sure it exists
my ($node_fh, $node_json) = tempfile( "node.json-XXXXXX", TMPDIR => 1 );
$obj->save_as($node_json);
# XXX Chef
);
if ( -e $env->path ) { # if we have a data file, then merge it
my $base = decode_json( file($node_json)->slurp );
my $env_default = dclone $env->default_attributes;
my $env_override =
ry apply subcommand
our $VERSION = '0.012'; # VERSION
use Pantry::App -command;
use autodie;
use JSON;
use namespace::clean;
sub abstract {
return 'Apply recipes or attributes to a node or role'
my ($self, $value) = @_;
if ($value eq 'false') {
$value = JSON::false;
}
elsif ( $value eq 'true' ) {
$value = JSON::true;
}
return $value;
}
1;
# vim: ts=2 sts=2 sw=2 et:
__
head1 DESCRIPTION
This class implements the C<pantry show> command, which is used to
display the JSON data for a node.
=for Pod::Coverage options validate
=head1 AUTHOR
David Golden <dagolden@cpan
package Plack::Middleware::JSONP::Headers;
{
$Plack::Middleware::JSONP::Headers::VERSION = '0.11';
}
#ABSTRACT: Wraps JSON response with HTTP headers in JSONP
use strict;
use parent qw(Plack::Middl
eware);
use Plack::Util;
use Plack::Builder;
use URI::Escape ();
use JSON ();
use Scalar::Util 'reftype';
use HTTP::Headers ();
use Plack::Util::Accessor qw(callback_key headers template);
sub prepa
nless ($self->template) {
$self->template('{ "meta": %s, "data": %s }')
}
}
sub wrap_json {
my ($self, $status, $headers, $data) = @_;
my $meta = { status => $status };
my @
rs or array references,
except for boolean values which should be set as L<JSON::Boolean>
values like C<JSON::true> and C<JSON::false>.
=head2 pantry_host
This optional attribute holds an alternate
:Log;
BEGIN {
$Poet::t::Log::VERSION = '0.13';
}
use Poet::Tools qw(rmtree tempdir_simple);
use JSON::XS;
use Test::Class::Most parent => 'Poet::Test::Class';
__PACKAGE__->initialize_temp_env();
s
my $log_conf = Poet::Log->generate_log4perl_config();
is( $log_conf, $expected, encode_json($conf_settings) );
};
my $default_layout = "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %
.. do some stuff to decide if you are supposed to even hit fb ...
# hypothetically encoded as JSON and parsed by client app
return {redirect => fb_redirect_url};
};
get '/auth/facebook/po
et_indexer( 'WebService::Dezi', { server => 'http://localhost:5000', content_type => 'application/json' } );
__PACKAGE__->table('person');
__PACKAGE__->add_columns(
person_id
TTRIBUTES
=head2 as_document( $self, $object )
Handles the insert operation. Generates a XML or JSON document
that will be indexed by the dezi service.
=cut
sub as_document {
my ( $self, $obj
Name=>'doc',);
} elsif ( $self->content_type eq 'application/json' ) {
require JSON;
$output_str = JSON::encode_json({ doc => $fields });
}
return $output_str;
}
__PACKAG
use strict;
use Carp;
use Moose;
use LWP::UserAgent;
use Net::Rexster::Response;
use Encode;
use JSON;
use URI::Escape;
use utf8;
has 'ua' => (is => 'ro', isa => "LWP::UserAgent", default => sub { L
::Rexster::Response->new(content => {});
}
# Decode from JSON and utf8
return Net::Rexster::Response->new(content => JSON->new->utf8->decode(decode_utf8($response->content)));
}
1; # Ma
ge App::MetaCPAN::Gtk2::Notify;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.05';
use JSON;
use LWP::UserAgent;
use Gtk2::Notify;
use File::Temp ();
use File::Spec;
use File::Slurp qw(writ
HODS
=cut
my $search_url = 'http://api.metacpan.org/v0/release/_search';
my $post_data = JSON::encode_json(
{
'size' => 20,
'from' => 0,
'sort' => [ { 'date' => { 'order
ost( $search_url, Content => $post_data );
if ( $resp->is_success ) {
my $res = JSON::decode_json( $resp->content );
return map { $_->{fields} } @{ $res->{hits}{hits} };
}
reported back with: $result") unless $result->content_type eq 'application/json';
my $repo_info = $result->content_json;
$self->log_fatal("Travis CI cannot find your repository; did you forget
reported back with: $result") unless $result->content_type eq 'application/json';
my $build_info = $result->content_json;
$self->log_fatal("Travis CI cannot find your build?!?")
if (ref
package WebService::XING;
use 5.010;
use Carp ();
use Digest::SHA ();
use JSON ();
use LWP::UserAgent;
use HTTP::Headers; # ::Fast
use HTTP::Request;
use Mo 0.30 qw(builder chain is required);
use
st_timeout', chain => 1);
sub _build_request_timeout { 30 }
has json => (builder => '_build_json', chain => 1);
sub _build_json { JSON->new->utf8->allow_nonref }
has warn => (builder => '_build_warn
_build__headers');
sub _build__headers {
HTTP::Headers->new(
# Accept => 'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding' => 'gzip, deflate',
)
}
### Funct
I.
=head1 INTERFACE
All of the methods defined here return hash reference which converted form JSON response.
As Net::Rexster::Client provides low level interface, please use Data::Dumper to check
na::Request::VERSION = '0.003';
}
# ABSTRACT: Asana Request Class
use MooX qw(
+HTTP::Request
+JSON
+URI
+URI::QueryParam
);
has api_key => (
is => 'ro',
required => 1,
);
has to => (
is =>
uest { shift->_http_request }
has json => (
is => 'ro',
lazy => 1,
builder => 1,
);
sub _build_json {
my $json = JSON->new;
$json->allow_nonref;
return $json;
}
sub _build__http_request {
my
string;
if ($self->method ne 'GET') {
push @headers, ('Content-type', 'application/json');
$body = $self->json->encode({ data => $self->data });
} elsif (%data) {
warn 'Request includes %data
::Request;
use strict;
use warnings;
use 5.010;
use WWW::Snooze::Serialize::JSON;
use URI;
use LWP::UserAgent;
use JSON;
our $AUTOLOAD;
sub new {
my $class = shift;
my $uri = shift;
m
> [],
args => {},
headers => undef,
serializer => WWW::Snooze::Serialize::JSON->new(),
%args
}, $class;
}
sub AUTOLOAD {
my $self = shift;
my $name = $AUTO
$r->foo();
# Request URL would be http://example.com/foo.json
$r->foo(42)->bar;
# http://example.com/foo/42/bar.json
$r->foo(undef, foo => 'bar');
# http://example.com
, REST operations can be
performed like so:
use WWW::Snooze;
use WWW::Snooze::Serialize::JSON;
use HTTP::Headers;
use Data::Dumper;
my $api = WWW::Snooze::request(
'https
new(
'X-Zen-ApiKey' => 'key'
),
serializer => WWW::Snooze::Serialize::JSON->new(
extension => ''
)
);
my $tasks = $api->projects(40075)->storie
_drizzle
L<http://github.com/chaoslawful/drizzle-nginx-module>
=item ngx_rds_json
L<http://github.com/agentzh/rds-json-nginx-module>
=item ngx_rds_csv
L<http://github.com/agentzh/rds-csv-nginx-mo
v dotvars find_code_dir path_for >],};
our $main_file_path = '/home/dotcloud/environment.json';
our $main_dotcloud_code_dir = '/home/dotcloud/code';
my @application_keys = qw< environment pro
\%retval;
} ## end sub _serialize_multiple
sub as_json {
my $self = shift;
require JSON;
return $self->_serialize_multiple(\&JSON::to_json, @_);
}
sub as_yaml {
my $self = shift;
req
or croak 'no suitable environment found';
if ($env =~ /\A \s* {/mxs) {
$self->merge_json($env);
}
else {
$self->merge_yaml($env);
}
return $self;
} ## end sub load
sub
, REST operations can be
performed like so:
use WWW::Snooze;
use WWW::Snooze::Serialize::JSON;
use HTTP::Headers;
use Data::Dumper;
my $api = WWW::Snooze::request(
'https
new(
'X-Zen-ApiKey' => 'key'
),
serializer => WWW::Snooze::Serialize::JSON->new(
extension => ''
)
);
my $tasks = $api->projects(40075)->storie
RSION = '0.02';
use JavaScript::V8;
use JSON::XS;
sub new {
my $self = bless {};
$self->{context} = JavaScript::V8::Context->new();
$self->{json} = JSON::XS->new->allow_nonref;
$self->{templa
e_string;
my $template_string_json = $self->{json}->encode($template_string);
die "need a template_name" unless $template_name;
my $template_name_json = $self->{json}->encode($template_name);
$s
var template_string = $template_string_json;
var template = swig.compile(template_string, { filename: $template_name_json });
templates[$template_name_json] = template;
false;
EOT
confess $@ if