my $self = shift;
my $payload = $self->json->encode({
description => $self->description,
indexed => $self->as_json_boolean($self->indexed),
name => $se
ders => $self->fin->headers_for_json,
payload => $payload,
on_success => sub {
my $response = shift;
my $h = $self->json->decode($response->content);
ts,
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $t =
_about ? $self->json->encode({about => $self->about}) : undef;
$self->fin->post(
path => $self->abs_path('objects'),
headers => $self->fin->headers_for_json,
paylo
payload,
on_success => sub {
my $response = shift;
my $h = $self->json->decode($response->content);
$self->_set_id($h->{id});
# Unset tag paths
ts,
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $o =
ooseX::Types::DateTime;
# ABSTRACT: Perl wrapper for talking with Bullfinch
use Data::UUID;
use JSON::XS;
use Memcached::Client;
use Net::Bullfinch::Iterator;
has '_client' => (
is => 'rw',
onal => 1 }
);
my ($rname, $json) = $self->_prepare_request($data, $queuename, $trace, $procby);
my $kes = $self->_client;
$kes->set($queue, $json, $expire);
my @items = ();
if(defined($resp)) {
$kes->get($rname.'/close');
my $decoded = decode_json($resp);
if(exists($decoded->{EOF})) {
last;
}
:Native->is_mime_type($mime_type)) {
Net::Fluidinfo::Value::Native->new_from_fin_type_and_json($fin_type, $content);
} else {
# instead of ordinary use(), to play nice with inherit
},
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
$class->
h
);
}
);
}
sub update {
my $self = shift;
my $payload = $self->json->encode({policy => $self->policy, exceptions => $self->exceptions});
$self->fin->put(
path),
query => { action => $self->action },
headers => $self->fin->headers_for_json,
payload => $payload
);
}
no Moose;
no MooseX::ClassAttribute;
__PACKAGE__->meta->ma
package Net::Fluidinfo::Base;
use Moose;
use JSON::XS;
use Carp;
use MooseX::ClassAttribute;
class_has json => (is => 'ro', default => sub { JSON::XS->new->utf8->allow_nonref });
has fin => (is =>
ub true {
shift->as_json_boolean(1);
}
sub false {
shift->as_json_boolean(0);
}
sub as_json_boolean {
my ($receiver, $flag) = @_;
$flag ? JSON::XS::true : JSON::XS::false;
}
sub get
to set description and path of self.
sub create {
my $self = shift;
my $payload = $self->json->encode({description => $self->description, name => $self->name});
$self->fin->post(
ders => $self->fin->headers_for_json,
payload => $payload,
on_success => sub {
my $response = shift;
my $h = $self->json->decode($response->content);
ts,
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $ns =
extensions quiet',
words => 'ENCODING CODECS',
constants => 'DOT NONE TRUE FALSE YAML JSON UTF8 ARRAY HASH SCALAR',
constant => {
ABSOLUTE => 'absolute',
RELATIVE => '
merge_mismatch => 'Cannot merge items for %s: %s and %s',
};
our $EXTENSIONS = [YAML, JSON];
our $ENCODING = UTF8;
our $CODECS = { };
our $STAT_TTL = 0;
#------------------------
# Configuration files can be in any data format which Badger::Codecs can
# handle (e.g. JSON, YAML, etc). The 'extensions' configuration option
# and any $EXTENSIONS defined in package
se Moose;
extends 'Net::Fluidinfo::Value::Native';
sub to_json {
my $self = shift;
no warnings; # value may be undef
$self->json->encode('' . $self->value);
}
no Moose;
__PACKAGE__->meta
:ConfigLoader::General>
L<Catalyst::Plugin::ConfigLoader::INI>,
L<Catalyst::Plugin::ConfigLoader::JSON>,
L<Catalyst::Plugin::ConfigLoader::Perl>,
L<Catalyst::Plugin::ConfigLoader::XML>, and
L<Catalyst
> files
and Maketext classes under your application's I18N namespace.
=head2 L<Catalyst::Plugin::JSONRPC>
=head2 L<Catalyst::Plugin::Message>
=head2 L<Catalyst::Plugin::MobileAgent>
=head2 L<Catal
ering pages with L<HTML::Template>.
=head2 L<Catalyst::View::Jemplate>
=head2 L<Catalyst::View::JSON>
=head2 L<Catalyst::View::Mason>
A view component for rendering pages with L<HTML::Mason>.
=he
ecs are for encoding and decoding data between all sorts of different
formats: Unicode, Base 64, JSON, YAML, Storable, and so on. Codecs are
simple wrappers around existing modules that make it tri
t_api_declare cronio => (
api_base_url => 'http://api.cron.io/v1',
api_format => 'json',
api_format_mode => 'content-type',
authentication => 1,
);
net_api_method create_use
such as PDF documents, e-mails, spreadsheets,
or even "behind the scenes" formats such as XML and JSON.
=item * Controller
As suggested by its name, the controller takes user requests and routes
the
ows options to default to
the values set by preceeding options.
Changed L<Badger::Codec::JSON> to use L<JSON::XS> if available.
Mr T is now using Badger 0.06 in production code and is happy to repo
ue::Set;
use Moose;
extends 'Net::Fluidinfo::Value::Native';
sub to_json {
my $self = shift;
my @strings = map $self->json->encode("$_"), @{$self->value};
'[' . join(',', @strings) . ']'
Strings;
use Moose;
extends 'Net::Fluidinfo::Value::Native';
sub to_json {
my $self = shift;
my @strings = map $self->json->encode("$_"), @{$self->value};
'[' . join(',', @strings) . ']';
package WebService::Linode::Base;
use warnings;
use strict;
use Carp;
use JSON;
use LWP::UserAgent;
use Data::Dumper;
=head1 NAME
WebService::Linode::Base - Perl Interface to the Linode.com API.
if ($response->content =~ m|ERRORARRAY|i) {
my $json = from_json($response->content);
if (scalar (@{$json->{ERRORARRAY}}) == 0) {
return $json->{DATA};
} else {
# TODO this only returns t
API
my $msg = "API Error " .
$json->{ERRORARRAY}->[0]->{ERRORCODE} . ": " .
$json->{ERRORARRAY}->[0]->{ERRORMESSAGE};
$self->_error(
$json->{ERRORARRAY}->[0]->{ERRORCODE},
$
ally for
display in the user's web browser (but can generate other types of
output such as PDF or JSON). The code in C<lib/MyApp/View> selects the
I<type> of view to use, with the actual rendering te
o install YAML or JSON just to run some of the Badger
tests) and to support some legacy systems that use data encoded in this way
(mostly dating back to the days before YAML and JSON were around). If
you're
starting out afresh then you're probably better off using YAML or JSON unless
you have good reason not to.
The syntax is similar to Perl in that it uses single quotes for literal
strings, squa
:> as a delimiter between hash keys and values,
thus providing an overlap with a useful subset of JSON syntax:
{
message: 'Hello World, this is some text',
things: ['a list' 'of s
ault
codec for a directory or filesystem.
$directory->codec('json');
$file = $directory->file('foo.json'); # has json codec set
=head1 AUTHOR
Andy Wardley L<http://wardley.org/>
=he