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
run_list ];
}
$data->{json_class} = "Chef::Role";
$data->{chef_type} = "role";
return $data;
}
sub _thaw {
my ($self, $data) = @_;
delete $data->{$_} for qw/json_class chef_type/;
for m
t;
use warnings;
package Pantry::Role::Serializable;
# ABSTRACT: A role to save/load data to/from JSON files
our $VERSION = '0.012'; # VERSION
use MooseX::Role::Parameterized;
use Moose::Util qw/get_
use File::Path qw/mkpath/;
use File::Slurp qw/read_file write_file/;
use Storable qw/dclone/;
use JSON 2;
parameter freezer => (
isa => 'Str',
);
parameter thawer => (
isa => 'Str',
);
role {
w", scalar_ref => 1 } );
# XXX check if string needs UTF-8 decoding?
my $data = $class->_json_thaw( $str_ref );
if ($thawer) {
$data = $class->$thawer($data);
}
$data->{_p
trict;
use warnings;
use Carp ();
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK SEEK_SET SEEK_END);
use JSON;
use Net::OAuth;
use URI;
use URI::Escape;
our $VERSION = '1.13';
my $request_token_url = 'http
t
request_token
request_secret
access_token
access_secret
root
no_decode_json
error
code
request_url
request_method
timeout
lwp_env_proxy
/);
$WebServ
timeout => $args->{timeout} || (60 * 60 * 24),
no_decode_json => $args->{no_decode_json} || 0,
no_uri_escape => $args->{no_uri_escape} || 0,
lwp_env_proxy
ead2 filename
An attribute for the file name to write to.
=head2 consume
Consumes a message by JSON encoding it and printing it, followed by \n
=head1 SEE ALSO
L<Message::Passing>
=head1 SPONSOR
rowd;
our $VERSION = 0.04;
use warnings;
use Moose;
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Catalyst::Authentication::Store::Crowd::User;
has 'find_user_url' => (
is => 'ro',
t_user( $info->{username} );
if ( $response->is_success ){
my $crowd_user_info = from_json( $response->decoded_content );
return Catalyst::Authentication::Store::Crowd::User->new({
>app->{app_name},
$self->app->{password}
);
$req->header('Accept' => 'application/json');
my $response = $ua->request( $req );
return $response;
}
1;
__END__
=head1 NAME
C
package NetDNA;
use strict;
use warnings;
use JSON;
use Net::OAuth;
use LWP::UserAgent;
use URI;
use Data::Dumper;
$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
my $base_url = "ht
# Decode JSON
my $decoded_json = decode_json($res->content);
if($decoded_json->{code} == 200) {
if($debug){
print Dumper $decoded_json->{data};
}
ed_json->{data};
} else {
if($debug){
print Dumper $decoded_json->{error};
}
return $decoded_json->{error};
}
}
#################### main pod docum
package Message::Passing::Types;
use MooseX::Types ();
use Moose::Util::TypeConstraints;
use JSON ();
use MooseX::Types::Moose qw/ Str HashRef ArrayRef /;
use MooseX::Types::Common::String qw/ NonEmpt
-declare => [qw{
Output_Type
Input_Type
Filter_Type
Codec_Type
Hash_from_JSON
JSON_from_Hash
ArrayOfStr
}];
role_type Input_Type, { role => 'Message::Passing::Role::Input
m_JSON,
as HashRef;
coerce Hash_from_JSON,
from NonEmptySimpleStr,
via { try { JSON->new->relaxed->decode($_) } };
MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
Hash_from_JSON,
gile standup bot ala tender
use strict;
use warnings;
use List::Util 'shuffle';
use DateTime;
use JSON::XS;
sub load {
my ( $class, $robot ) = @_;
$robot->respond(
qr/(?:cancel|stop)
.com/api/v1/messages.json')
->header({
Authorization => "Bearer $ENV{HUBOT_STANDUP_YAMMER_TOKEN}",
Accept => 'application/json',
})
FAILED: $hdr->{Reason}");
} else {
my $data = decode_json($body);
if ($data->{messages}) {
$response->s
age My::Memcached;
use strict;
use warnings;
use parent qw(Cache::Memcached::Fast);
use JSON;
use Hash::Compact;
my $OPTIONS = {
foo => {
alias_for => 'f',
},
w(decode_json $value, $OPTIONS);
}
sub set {
my ($self, $key, $value, $expire) = @_;
my $hash = Hash::Compact->new($value, $OPTIONS);
$self->SUPER::set($key, encode_json $hash->
nfig_short_merge('Test::EOL', { trailing_whitespace => 0 }),
#
# [Test::CPAN::Meta::JSON]
# [Test::CheckDeps]
# [Test::Portability]
# ;[Test::Pod::LinkCheck] ; Both of
]
# [Test::UseAllModules]
# [Test::Version]
(map { 'Test::'.$_ } qw(CPAN::Meta::JSON CheckDeps Portability Synopsis MinimumVersion CheckManifest DistManifest UseAllModules Version)),
# ; META maintenance
# [MetaConfig]
# [MetaJSON]
# [MetaYAML]
qw( CheckPrereqsIndexed MetaConfig MetaJSON MetaYAML ),
#
# [MetaNoIndex]
# dire
NetDNA( 'jdorfman', 'fbe242bcaf4c95ed39a', 'e1429ab0873d0f');
$api->get("/account.json");
$api->get("/account.json", 1);
# Get first name which is set using constructor.
#$alias = $api->getAlias()
ERS{$_[1]} }
eval {
require JSON;
JSON->import(2.00);
register_read_type(json => \&JSON::decode_json);
register_write_type(json => \&JSON::encode_json);
};
1;
__END__
=head1 NAME
Z
;
$sock->send($msg);
}
# json (if JSON.pm is available)
$sock->send_as( json => { foo => "bar" } );
my $thing = $sock->recv_as( "json" );
# custom serialization
ZeroM
ample, for JSON we do
the following (this is already done for you in ZeroMQ.pm if you have
JSON.pm installed):
use JSON ();
ZeroMQ::register_write_type('json' => \&JSON::encode_json);
Zer
these personalized modules on CPAN. I even bantered
around the idea of using L<MetaCPAN's author JSON input|https://github.com/SineSwiper/Dist-Zilla-PluginBundle-BeLike-You/blob/master/BeLike-You.pod
ans that text/html gets picked first
req.setRequestHeader(
'Accept',
'text/x-json; q=1.1'
);
req.onreadystatechange = function() {
if (req.readyState == 4)
);
};
req.send(null);
}
function handleUploadProgressResults(results) {
var state = JSON.parse(results);
if ( state != undefined ) {
state.starttime = progress.startt
data = data();
else if (typeof data == 'string') {
Ajax.get(data, function(r) { proc(JSON.parse(r)) });
return;
}
return proc(data);
}
//--------------------------------
espace::autoclean;
extends 'AnyEvent::Campfire';
use AnyEvent;
use AnyEvent::HTTP;
use URI;
use JSON::XS;
use Try::Tiny;
sub BUILD {
my $self = shift;
if ( !$self->authorization || !scalar
on,
);
my $on_json = sub {
my $json = shift;
if ( $json !~ /^\s*$/ ) {
my $data;
try {
$data = decode_json($json);
$sel
$on_json->($chunk);
}
);
};
my $line_reader = sub {
my ( $handle, $line ) = @_;
$on_json->($line);
};
if the URI query string is ?progress_id=<id> intercept the request
# and display the progress JSON.
my $query = $c->req->uri->path_query;
if ( $c->req->method eq 'GET' && $query =~ m{\?pro
};
}
# format the progress data as JSON
my $json = '{"size":%d,"received":%d,"aborted":%d}';
my $output = sprintf $json,
$progress->{size},
$progress->{rec
no-cache, must-revalidate, post-check=0, pre-check=0' );
$c->response->content_type( 'text/x-json' );
$c->response->body( $output );
}
sub upload_progress_javascript {
my $c = shift;
eue
use strict;
use warnings;
use v5.10;
use Test::More 0.96;
use PICA::Modification;
use Test::JSON::Entails;
use parent 'Exporter';
our @EXPORT = qw(test_queue);
sub test_queue {
my $queue = sh
these personalized modules on CPAN. I even bantered
around the idea of using L<MetaCPAN's author JSON input|https://github.com/SineSwiper/Dist-Zilla-PluginBundle-BeLike-You/blob/master/BeLike-You.pod
ll be prompted to confirm
deletion.
=head3 show
$ pantry show node NAME
Prints to STDOUT the JSON data for the given C<NAME>.
=head3 apply
$ pantry apply node NAME --recipe nginx --role mail
al string containing 'true' or 'false', it will be
replaced in the configuration data with actual JSON boolean values.
N.B. While the term C<--default> is used for command line consistency, attribute
iable C<EDITOR> on
the configuration file for the C<name> node.
The resulting file must be valid JSON in a form acceptable to Chef. Generally,
you should use the C<apply> or C<strip> commands instea