Bin/../mojo/lib";
use lib "$FindBin::Bin/../../mojo/lib";
}
use Mojolicious::Lite;
use Mojo::JSON;
app->renderer->add_helper(
action => sub {
my ( $self, $action ) = @_;
sta
close $fh;
my $json = Mojo::JSON->new;
my $data = $json->decode($content);
if ( $json->error ) {
die $json->error;
}
_->{$param} )
|| $value ~~ $_->{$param}
} @data;
}
$self->render_json( \@data );
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
Please try /api/action,
{
warn "Error: $@\n";
}
my ( $jsons, $keywords_used ) = _make_json_center( $instructions );
my $json = "[\n" . join( ",\n", @{ $jsons } ) . "\n]\n";
$self->deparsed( Bigtop:
backends( $tree );
$self->template_disable( 1 );
return $self->stash->controller->data( $json . $self->deparsed );
}
sub do_move_block_after {
my $self = shift;
my $mover = shift;
# make jason here
my ( $jsons, $keywords_used ) = _make_json_center( $result );
my $json = "[\n" . join( ",\n", @{ $jsons } ) . "\n]\n";
$already_c
ntation is very XML/XPath-centric, but there's certainly room to incorporate other formats (YAML, JSON, etc)
=item *
Figure out how to make friendly with Test::Harness and whatnot
=item *
Allow e
net_api_declare backtype => (
base_url => 'http://api.backtype.com',
format => 'json',
format_mode => 'append',
);
net_api_method comments_search => (
description => 'Search
use Supervisor::Class
version => $VERSION,
base => 'Supervisor::Base',
codec => 'JSON',
accessors => 'id server',
constants => 'HASH ARRAY STOPPED :rpc',
messages => {
ser
rt %s",
rpc_error => "server error: %s, message: %S",
json_encode => "unable to encode the packet",
json_decode => "unable to decode the packet",
network => "
or.rpc.client._call.';
eval {
$request = encode(
{
jsonrpc => JSONRPC,
method => $method,
params => $params,
ntry[% IF template_engine %] qw{ -TemplateEngine=[% template_engine %] }[% END %];
[% END %]
use JSON;
use Gantry::Utils::TablePerms;
our @ISA = qw( Gantry );
[% FOREACH module IN external_modules
[% plugins +%]
};
our @ISA = qw( [% app_name %] );
use JSON;
use Gantry::Utils::TablePerms;
[% ELSE %]
use base '[% app_name %]';
use JSON;
use Gantry::Utils::TablePerms;
[% END %]
[% child_outpu
tions => $perm_obj->real_row_options( $row ),
}
);
}
if ( $params->{ json } ) {
$self->template_disable( 1 );
my $obj = {
headings => $
en warned.
package GENKids;
use strict;
use warnings;
use Gantry qw{ -TemplateEngine=TT };
use JSON;
use Gantry::Utils::TablePerms;
our @ISA = qw( Gantry );
use Kids::Model;
sub schema_base_clas
net_api_declare backtweet => (
base_url => 'http://api.backtype.com',
format => 'json',
format_mode => 'append',
);
net_api_method tweets_by_url => (
description =>
'Re
Supervisor::Class
version => $VERSION,
base => 'Supervisor::Session',
codec => 'JSON',
utils => 'params',
accessors => 'supervisor client listener host port methods',
const
ion' => "this json-rpc version \"%s\", is not supported",
'rpc_format' => "this json-rpc format is not supported",
'rpc_batch' => "the usage of json-rpc batch mode is
not supported",
'rpc_notify' => "the usage of json-rpc notifications is not supported",
}
;
# ----------------------------------------------------------------------
# POE Events
# ----
serAgent;
use URI;
use Net::OAuth;
use JSON;
{
my @attr_refs = \(
my %base_uri_of,
my %ua_of, my %auth_of, my %actions_of,
my %json_of,
);
sub new {
my (
of{$ident} = $options->{ua} || LWP::UserAgent->new();
$json_of{$ident} = $options->{json} || JSON->new();
$actions_of{$ident} = $options->{actions}
||
my $data;
eval {
$data = $json_of{$ident}->decode( $response->decoded_content );
};
croak "Invalid JSON from [$uri]" if $@;
return $data;
}
You have been warned.
package Kids::GEN::Child;
use strict;
use warnings;
use base 'Kids';
use JSON;
use Gantry::Utils::TablePerms;
use Kids::Model::child qw(
$CHILD
);
#---------------------
tions => $perm_obj->real_row_options( $row ),
}
);
}
if ( $params->{ json } ) {
$self->template_disable( 1 );
my $obj = {
headings => $
rows => $retval->{ rows },
};
my $json = to_json( $obj, { allow_blessed => 1 } );
return( $json );
}
$self->stash->view->data( $retval );
} # END do_ma
package WWW::Notifo;
use warnings;
use strict;
use Carp;
use JSON;
use Data::Dumper;
use LWP::UserAgent;
use MIME::Base64;
use base qw( Exporter );
our @EXPORT_OK = qw( notifo );
=head1 NAME
WWW
elf->_ua->post( join( '/', API, $method ), Content => \%args );
my $rd = $self->{last} = eval { JSON->new->decode( $resp->content ) };
my $err = $@;
if ( $resp->is_error ) {
croak join ' ',
'error';
croak $resp->status_line;
}
croak $err if $err; # Only report errors parsing JSON we have a 200
return $rd;
}
sub api {
my ( $self, $method, @args ) = @_;
return $self->_ap
nteraction away from the user's code
=item * MVC (default views for HTML via HTML::Template, and JSON)
=item * Dynamic reloading of modules upon change (bypass-able for production sites)
=item * Au
::Debug::Handler;
$VERSION = "3.0200";
use strict;
use warnings;
use DBI;
use Time::HiRes;
use JSON::DWIW;
use Apache::Voodoo::MP;
use Apache::Voodoo::Constants;
sub new {
my $class = shift;
my
"image/png",
"trace.png" => "image/png",
"warn.png" => "image/png"
};
$self->{json} = JSON::DWIW->new({bad_char_policy => 'convert', pretty => 1});;
return $self;
}
sub handler {
m
if (ref($return) eq "HASH") {
$self->{mp}->content_type("application/json");
$self->{mp}->print($self->{json}->to_json($return));
}
else {
$self->{mp}->content_type("text/plain");
$s
rict;
use warnings;
no warnings 'uninitialized';
use base("Apache::Voodoo::Debug::Common");
use JSON::DWIW;
use constant {
DEBUG => 'LOG',
INFO => 'INFO',
WARN => 'WARN',
ERROR
stant WF_VERSION => "2.00";
use constant WF_PROTOCOL => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2';
use constant WF_PLUGIN => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Librar
hift;
my $id = shift;
my $conf = shift;
my $self = {};
bless $self,$class;
$self->{json} = JSON::DWIW->new({bad_char_policy => 'convert'});
$self->{setHeader} = sub { return; };
$self->{
=head1 NAME
Catalyst::Plugin::Server::JSONRPC -- Catalyst JSONRPC Server Plugin
=head1 SYNOPSIS
package MyApp;
use Catalyst qw/Server Server::JSONRPC/;
package MyApp::Controller::Exam
sub echo : JSONRPC { # available as: example.echo
my ( $self, $c, @args ) = @_;
$c->stash->{jsonrpc} = join ', ', @args;
}
sub ping : JSONRPCPath('/ping
sh->{jsonrpc} = 'Pong';
}
sub world : JSONRPCRegex(/hello/) { # available as: *hello*
my ($self, $c) = @_;
$c->stash->{jsonrpc} = 'World';
}
sub echo : JSONRPCLo
::Accessor::Fast';
use LWP::UserAgent;
use JSON;
__PACKAGE__->mk_accessors(qw(type src root name value choice));
my $mimemap = { json => 'application/json', xml => 'text/xml' };
sub new
{
my $sel
>choice($self->$parser($res->content));
}
}
sub parse_json
{
my $self = shift;
my $content = shift;
my $json = new JSON;
my $ref = $json->decode($content);
my @choices = ();
$ref = $ref->{$
pache::Voodoo::Debug::Common");
use Apache::Voodoo::Constants;
use DBI;
use HTML::Template;
use JSON::DWIW;
sub new {
my $class = shift;
my $id = shift;
my $conf = shift;
my $self = {};
bl
m(
debug_root => $ac->debug_path(),
app_id => $self->{id}->{app_id}
);
$self->{json} = JSON::DWIW->new({bad_char_policy => 'convert', pretty => 1});
$self->{db_info} = $ac->debug_dbd
e {
my $self = shift;
my $j;
if (scalar(@_) > 1) {
$j = $self->{json}->to_json(\@_);
}
else {
$j = $self->{json}->to_json($_[0]);
}
return $j;
}
sub _write {
my $self = shift;
my $dat
e idea for JSON. What website these days doesn't use even
# a little AJAX?
unless (defined($self->{'views'}->{'JSON'})) {
require Apache::Voodoo::View::JSON;
$self->{'views'}->{'JSON'} = Apache
::Voodoo::View::JSON->new();
}
# models get the config and every model except themselves
# to prevent accidental circular references
foreach my $key (keys %{$self->{'models'}}) {
my %m = map {
name="type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="json" />
<xs:enumeration value="xml" />
</xs:restriction>
</xs:simpleType>
</xs:attribut