package Net::YAP;
$VERSION = 0.6;
use strict;
use base qw(Net::OAuth::Simple);
use JSON::Any;
our $AUTH_URL = "https://api.login.yahoo.com/oauth/v2/request_auth";
our $REQ_URL = "https://api.logi
;
my $res = $self->make_restricted_request("$url", 'GET', format => 'json');
my $data = eval { JSON::Any->new->from_json($res->content) };
return $data->{guid}->{value};
}
=head2 get_us
;
my $res = $self->make_restricted_request("$url", 'GET', format => 'json');
my $data = eval { JSON::Any->new->from_json($res->content) };
return $data->{profile};
}
=head1 AUTHOR
The
g = shift;
$self->{taggedpages}{$tag} = shift;
}
=head2 json_verbose
Set the json_verbose flag.
=cut
sub json_verbose { $_[0]->{json_verbose} = $_[1] }
=head2 response
Retrieve a fake respon
0.223 "Object::Event";
use AnyEvent 5.202;
use AnyEvent::HTTP 1.44;
use JSON 2.15 qw(to_json from_json);
use URI;
use Carp "croak";
use POSIX qw(strftime);
# Sub
sub current_time_offset
>{__cookie_jar},
$cb || sub {
($data, $header) = @_;
$data = from_json($data);
$v->send;
}
);
$v->recv if !$cb;
return wantarray ? ($da
400) {
# say $data;
}
else {
$data = from_json($data);
my $unread_plurks = $data->{plurks};
if (@$unread_plurks)
Y_ENTER/;
use Socialtext::Wikrad qw/$App/;
use Socialtext::Resting;
use Socialtext::EditPage;
use JSON;
use Data::Dumper;
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
ta ...');
$r->accept('application/json');
my $page_name = $App->get_page;
my $json_text = $r->get_page($page_name);
my $page_data = jsonToObj($json_text);
$App->{cui}->nostatus;
package Socialtext::Resting::LocalCopy;
use strict;
use warnings;
use JSON::XS;
=head1 NAME
Socialtext::Resting::LocalCopy - Maintain a copy on disk of a workspace
=head1 SYNOPSIS
Socialtext::Rest
et_pages();
$r->accept('application/json');
$r->json_verbose(1);
for my $p (@pages) {
print "Saving $p ...\n";
my $obj = decode_json($r->get_page($p));
# Trim the
my $json_file = "$wikitext_file.json";
open(my $jfh, ">$json_file") or die "Can't open $json_file: $!";
print $jfh encode_json($obj);
close $jfh or die "Can't write $json_file
'
=> where {
# these are the types of things that cannot be
# serialized into JSON so will be neither arguments
# or return values in our RPC environment.
($_->is_a
xpRef, GlobRef and Object. This is
primarily because these types are not easily serialziable with
JSON. Below is the type tree that JSORB supports and is
recommended.
Unit
Any
Item
Bo
RPC::Lite::Error;
use RPC::Lite::Notification;
use Data::Dumper;
our $DEFAULTSERIALIZER = 'JSON';
=pod
=head1 NAME
RPC::Lite::Client - Lightweight RPC client framework.
=head1 SYNOP
t->new(
{
Transport => 'TCP:Host=blah.foo.com,Port=10000',
Serializer => 'JSON', # JSON is actually the default,
# this argument is unnecessary
}
.3:10000 via TCP and use the JSON serializer.
my $client = RPC::Lite::Client->new(
{
Transport => 'TCP:Host=192.168.0.3,Port=10000',
Serializer => 'JSON',
}
);
# print
package Net::FleetDB;
use warnings;
use strict;
use Carp qw(croak);
use IO::Socket::INET;
use JSON::XS::VersionOneAndTwo;
our $VERSION = '0.33';
sub new {
my ( $class, %args ) = @_;
my $host
_json( \@args );
warn "-> $request\n" if 0;
$socket->print( $request . "\n" ) || die $!;
my $response = $socket->getline || die $!;
warn "<- $response" if 0;
my $return = from_json
side and JSON will be used to send the form parameters. What to do?
Well CPAN to the rescue. Install the TT filter for JSON, along with the
JSON.pm module. Now create a template named json.tt like
this:
[% USE JSON %]
[% view.data.json %]
Change the froms template from form.tt to json.tt and add the following
statement:
$self->content_type('application/json');
You are now sendi
ng your form as a JSON datastream.
=item cancel_action (a code ref)
Called with:
your self object
the data you passed to add, edit or deltet
the action (add, edit or delete)
the use
tion::JSORB;
use Moose;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
use JSORB;
use JSON::RPC::Common::Marshal::HTTP;
extends 'Catalyst::Action';
sub execute {
my $self = shift;
s "Bad dispatcher - $dispatcher (must inherit JSORB::Dispatcher::Catalyst)";
my $marshaler = JSON::RPC::Common::Marshal::HTTP->new;
my $call = $marshaler->request_to_call($c->request);
$self, $call, @args) = @_;
(blessed $call && $call->isa('JSON::RPC::Common::Procedure::Call'))
|| confess "You must pass a JSON::RPC::Common::Procedure::Call to the handler, not $call";
http://localhost:8080/?method=/math/simple/add¶ms=[2,2]
# and get back a response
{ "jsonrpc" : "2.0", "result" : 2 }
## compile your own Javascript client
## library for use in a we
goal of this module is to provide a cleaner and more formalized
way to do AJAX programming using JSON-RPC in the flavor of Object
Request Brokers.
=head2 FUTURE PLANS
Currently this is more focused
ithInvocant;
use Moose;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
use JSORB;
use JSON::RPC::Common::Marshal::HTTP;
extends 'Catalyst::Action';
sub execute {
my $self = shift;
her - $dispatcher (must inherit JSORB::Dispatcher::Catalyst::WithInvocant)";
my $marshaler = JSON::RPC::Common::Marshal::HTTP->new;
my $call = $marshaler->request_to_call($c->request);
Net::FTP;
use Getopt::Long;
use File::Temp qw(tempdir);
use YAML qw(Dump LoadFile DumpFile);
use JSON::XS;
use version;
use File::Basename qw(dirname);
use CPAN;
use CPANPLUS::Backend;
use Config;
us
=head2 load_meta
Loads META.yml or META.json
=cut
sub load_meta {
my $self = shift;
if ( -e 'META.json' ) {
open +( my $f ), '<', 'META.json' or die $!;
local $/ = undef;
local $\ = undef;
return JSON::XS::decode_json(<$f>);
}
else {
return LoadFile('META.yml');
}
}
1;
__END__
=head1 NAME
App::Pm2Port - Creates FreeBSD port from Per
necessary to communicate with clients.
=head1 SUPPORTED SERIALIZERS
=over 4
=item JSON (client default)
"JSON (JavaScript Object Notation) is a lightweight data-interchange format.
It is easy for
JavaScript Programming Language,
Standard ECMA-262 3rd Edition - December 1999."
-- http://www.json.org/
=item XML
"Extensible Markup Language (XML) is a simple, very flexible text format
derived
p qw/croak/;
use File::Temp;
use Socialtext::Resting::DefaultRester;
use Socialtext::Resting;
use JSON::XS;
=head1 NAME
Socialtext::EditPage - Edit a wiki page using your favourite EDITOR.
=cut
ou
is mandatory";
my $rester = $self->{rester};
$rester->accept('application/json');
my $pages = decode_json($rester->get_taggedpages($tag));
unless (@$pages) {
die "No pages fou
package JSORB::Server::Traits::WithDebug;
use Moose::Role;
use Text::SimpleTable;
use JSON ();
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
around 'build_handler' => sub {
my $next
ext::SimpleTable->new(15, 55);
$t3->row(
'Response' => JSON->new->pretty(1)->encode(
JSON->new->decode(
$response->content
)
e = shift @{ $self->MessageQueue() };
# handshake string examples:
#
# RPC-Lite 1.0 / JSON 1.1
# RPC-Lite 2.2 / XML 3.2
if ( $message !~ /^RPC-Lite (.*?) \/ (.*?) (.*?)$/ )
{
use Moose;
use HTTP::Server::Simple;
use HTTP::Request;
use HTTP::Response;
use Try::Tiny;
use JSON::RPC::Common::Marshal::HTTP;
our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
with 'Moo
has 'request_marshaler' => (
is => 'ro',
isa => 'JSON::RPC::Common::Marshal::HTTP',
default => sub {
JSON::RPC::Common::Marshal::HTTP->new
},
);
has 'handler' => (
lt_to_response($result);
} catch {
# NOTE:
# should this return a JSONRPC error?
# or is the standard HTTP Error okay?
# - SL
HTTP::