hotspots
immutabilize
immutabilizes
immutabilized
inline
inlines
invocant
invocant's
irc
IRC
isa
JSON
login
namespace
namespaced
namespaces
namespacing
OO
OOP
ORM
overridable
parameterizable
paramete
but
less smart.
This is designed for general data validation. For example, it is useful for CSV, JSON, XML, and so on.
=head2 Concepts
=over
=item Natural as Perl code
I love C<Smart::Args> becau
fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").t
{try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);f
n!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"
Jsonrpc;
use strict;
use warnings;
use Mojo::JSON;
use Mojo::Base 'Mojolicious::Controller';
use Encode;
our $toUTF8 = find_encoding('utf8');
our $VERSION = '0.89';
has 'JSON' => sub { Mojo::JSON
use
# the data is not sent in the same place..
my $log = $self->app->log;
my $json = $self->JSON;
# send warnings to log file preserving the origin
local $SIG{__WARN__} = sub {
method ){
/^POST$/ && do {
# Data comes as JSON object, so fetch a reference to it
$data = $json->decode($self->req->body);
$id = $dat
1,
desc => 'Set content-type header',
args => sub { ['application/json','application/x-www-form-urlencoded'] },
proc => sub { $client->set_header( 'C
data structures to STDOUT',
args => sub {
[ 'JSON', 'Data::Dumper', 'Data::Dump', 'YAML' ];
},
proc
ad1 VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('api.json');
$client->enable(
'Auth::Header',
header_name => 'X-API-Auth',
hea
Digest::MD5 'md5_hex';
use Moose;
use MooseX::Method::Signatures;
use MooseX::ClassAttribute;
use JSON;
use URI::Encode qw(uri_encode);
use LWP::UserAgent;
use Date::Parse;
use YAML qw(LoadFile DumpFi
$res->code != 200
and $self->log->logdie( "Unable to contact Toodledo\n");
my $ref = decode_json( $res->content )
or $self->log->logdie( "Content invalid\n");
$self->log->logdie( $ref->{e
TP::Request->new( 'POST', $server);
my $ua = new LWP::UserAgent;
my $cheader = 'application/xdi+json';
if ($context) {
$cheader .= ';contexts=1';
}
$request->header('accept' => $cheader);
$req
", $response->status_line;
return undef;
}
}
sub _xdi_response {
my ($json) = @_;
my $struct = XDI::_decode($json);
if (defined $struct) {
my $tuple = XDI::pick_xdi_tuple($struct,['$false$
is a JSON encoded representation of the nodes requested in the $get operation. Other
operations will return an empty hash {} upon success. Default behavior is to automatically convert
the JSON to a
trict;
use warnings;
our $VERSION = '1.00';
use base qw(Exporter);
use File::HomeDir qw();
use JSON;
our @EXPORT_OK = qw(debug toodledo_encode toodledo_decode toodledo_time
arg_encode home
PP_TOODLEDO_DEBUG};
}
sub arg_encode
{
local $_ = shift;
s/\n/\\n/g;
ref $_
? encode_json( $_ )
: $_;
}
sub toodledo_encode
{
local $_ = shift;
s/&/%26/g;
s/;/%3B/g;
$_;
}
1;
__END__
=head1 NAME
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 METHODS
=head2 arg_encode
JSON encoding for parameters submitted to the API.
=head2 home
User's home directory. Broken out so
YAML string
$p->freeze();
# ----
# __CLASS__: "Point"
# x: 10
# y: 10
# unpack the JSON string into a class
my $p2 = Point->thaw(<<YAML);
----
__CLASS__: "Point"
x: 10
y: 10
);
# Content-Type: application/json
use JSON::XS;
$client->header('Content-Type', 'application/json')
->post(
encode_json({ foo => 1 }),
sub {
= @_;
# ...
}
);
$client->header('Accept', 'application/json')
->query({ key => 'value' })
->query('key', 'value')
->get(
head1 SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON', 'io' => 'AtomicFile');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa
methods to load/store a class
## on the file system
$p->store('my_point.json');
my $p2 = Point->load('my_point.json');
=head1 METHODS
=over 4
=item B<load ($filename)>
=item B<store ($file
head1 SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON', 'io' => 'File');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'In
methods to load/store a class
## on the file system
$p->store('my_point.json');
my $p2 = Point->load('my_point.json');
=head1 METHODS
=over 4
=item B<load ($filename)>
=item B<store ($file
ION = '0.05';
use strict;
use warnings;
use Carp;
use Log::Log4perl qw(get_logger :levels);
use JSON::XS;
use Data::Dumper;
use Data::UUID;
use Storable qw(dclone);
use Clone qw(clone);
use XDI::Co
get_logger();
my $struct;
eval {
$struct = JSON::XS::->new->pretty(1)->decode($string);
};
if ($@ && not defined $struct) {
carp("Not a valid JSON string");
carp($@);
return undef;
} else
is a JSON encoded representation of the nodes requested in the $get operation. Other
operations will return an empty hash {} upon success. Default behavior is to automatically convert
the JSON to a
;
use WWW::Foursquare::Events;
use WWW::Foursquare::Pages;
use WWW::Foursquare::Pageupdates;
use JSON;
use LWP;
use URI::Escape;
sub new {
my ($class, %params) = @_;
my $self = {};
l" if $self->{debug};
my $res = $self->{request}->{ua}->get($result_url);
return decode_json($res->content()) if $res->code() == 200;
# throw exception
die $res->content();
}
sub _
;
my $response = Net::HTTP::Spore::Response->new(
200, ['Content-Type', 'application/json'], '{"foo":1}';
);
$response->request($request);
=head1 DESCRIPTION
Net::HTTP::Spore::R
hen the body is sets for the first time.
=item content_type
$res->content_type('application/json');
my $ct = $res->content_type;
Gets or sets the content type of the response body
=item co
ype' => 'application/json']);
Gets or sets HTTP response headers.
=item header
my $cl = $res->header('Content-Length');
$res->header('Content-Type' => 'application/json');
Shortcut for C<<
able {
my $message = shift;
return $message->content_type =~ m{\b(?:xml|^text|application/json|application/x-www-form-urlencoded)\b} || do {
my $content = substr($message->decoded_cont
age Mojolicious::Plugin::BlogSpam;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::URL;
use Mojo::JSON;
use Mojo::Log;
use Mojo::UserAgent;
use Scalar::Util 'weaken';
our $VERSION = '0.05';
# Todo:
$self->{log}) {
# Serialize comment
my $msg = "[$1]: " . ($2 || '') . ' ' .
Mojo::JSON->new->encode($self->hash);
# Log error
if ($1 eq 'ERROR') {
$log->error($msg);
$Net::HTTP::Spore::VERSION = '0.05';
}
# ABSTRACT: SPORE client
use Moose;
use IO::All;
use JSON;
use Carp;
use Try::Tiny;
use Scalar::Util;
use Net::HTTP::Spore::Core;
# XXX should we let the
bject ) = @_;
my $spec;
try {
$spec = JSON::decode_json($string);
}
catch {
Carp::confess( "unable to parse JSON spec: " . $_ );
};
try {
$opts->{base
m_spec('twitter.json');
# for identica
my $client = Net::HTTP::Spore->new_from_spec('twitter.json', base_url => 'http://identi.ca/com/api');
$client->enable('Format::JSON');
my $tim