scriptName//;
my ($response_type, $resource_type, $resource_id) = ( $uri =~ m{/?(?:(html|xml|json|atom|rss)/)?([^?\\\/]*)(?:/([^?\\\/]+)?)?} );
$self->response_type = lc($response_type) || '
onds
);
my $json_hash_ref = send_request($self->{'account'}, 'feeds/register', \%params);
# Return true on success.
if (exists($json_hash_ref->{'result'}) and ($json_hash_ref->{'re
rl,
);
my $json_hash_ref = send_request($self->{'account'}, 'feeds/unregister', \%params);
# Return true on success.
if (exists($json_hash_ref->{'result'}) and ($json_hash_ref->{'r
pkey'},
'q' => $query,
);
my $json_hash_ref = send_request($self->{'account'}, 'count', \%params);
if ($DEBUG) { print STDERR "count returned: " . Dumper($json_hash_ref) . "\n"; }
# Ret
urn count or zero when impossible.
if (exists($json_hash_ref->{'count'})) {
return $json_hash_ref->{'count'};
}
else {
return 0;
}
}
sub searc
arams{'since'} = $since;
}
my $json_hash_ref = send_request($self->{'account'}, 'search', \%params);
# Return results data structure.
return $json_hash_ref;
}
sub submit {
my ($s
:Types::ISO8601 qw/ ISO8601DateTimeStr /;
use MooseX::Types::DateTime qw/ DateTime /;
use JSON qw/ encode_json /;
use namespace::autoclean;
our $VERSION = '0.003';
$VERSION = eval $VERSION;
with 'Me
|| 'none',
'@message' => exists($data->{message}) ? delete($data->{message}) : encode_json($data),
'@fields' => $data,
},
exists($data->{uuid}) ? ( id => delete
=============================
# JSON.pm calls TO_JSON() method on the blessed hash.
#
# NOTE: The convert_blessed flag must be set (false by default).
# my $json = JSON->new->convert_blessed;
# ======
================================================================
use JSON;
my $json = JSON->new->convert_blessed;
our @USER_SUBJECTS = ( 'roles', 'state', 'markers', 'poco' );
sub get {
my ($self,
$raise_not_found) = @_;
my %params = (
'identityURL' => $identity_url,
);
my $json_hash_ref;
eval {
$json_hash_ref = send_request($self->{'account'}, 'users/get', \%params);
};
# Re
View>
The base class, which creates a view of the application.
The result can be represented in JSON, XML and HTML.
L<XML::LibXSLT> is used to generate HTML.
=item L<Ambrosia::Validator>
The class
rnings;
use Data::MessagePack;
use JSON;
use Storable;
use Benchmark ':all';
my $a = do 'benchmark/data.pl';
print "-- serialize\n";
print "$JSON::Backend: ", $JSON::Backend->VERSION, "\n";
print "D
";
print "Storable: $Storable::VERSION\n";
cmpthese timethese(
-1 => {
json => sub { JSON::encode_json($a) },
storable => sub { Storable::freeze($a) },
mp => sub
number of purposes, but the
principle intention is to make MARC data amenable to serializing into
JSON, YAML, etc. Field and subfield order is preserved. Multiple
instances of either are also allowed.
ed by Frederic Demians' MARC::Moose::Formater::JSON.
Format inspired by http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json
=head1 AUTHOR
Clay Fouts <cfouts@khephera.n
Auth;
use Any::Moose;
with 'Net::OpenStack::Compute::AuthRole';
#use Data::Dumper;
use JSON qw(from_json to_json);
use LWP;
has _info => (is => 'ro', lazy => 1, builder => '_build_info');
has base_
content_type => 'application/json', content => to_json($auth_data));
die $res->status_line . "\n" . $res->content unless $res->is_success;
my $data = from_json($res->content);
my $token
[], ref $proto || $proto;
}
}
sub sub_nil
{
my $obj = shift;
sub { $obj };
}
sub TO_JSON
{
return {};
}
sub AUTOLOAD
{
unless ( defined wantarray ) # don't bother doing more
ackage POE::Component::Server::JSONRPC::Http;
use strict;
use warnings;
use POE::Component::Server::JSONRPC; # for old Perl 5.005
use base qw(POE::Component::Server::JSONRPC);
our $VERSION = '0.03';
::Server::SimpleHTTP
Filter::Line
/;
use JSON::Any;
use Data::Dumper;
=head1 NAME
POE::Component::Server::JSONRPC::Http - POE http based JSON-RPC server
=head2 new
constructor
=cut
sub n
($self, $kernel, $session, $heap) = @_[OBJECT, KERNEL, SESSION, HEAP];
$kernel->alias_set( 'JSONRPCHTTP' );
if (defined($self->{Authenticate})) {
$kernel->state('http_input_handler'
:Server::JSONRPC::Tcp;
use strict;
use warnings;
use base qw(POE::Component::Server::JSONRPC);
our $VERSION = '0.01';
use POE qw/
Component::Server::TCP
Filter::Line
/;
use JSON::Any;
=
head1 NAME
POE::Component::Server::JSONRPC::Tcp - POE tcp based JSON-RPC server
=head2 new
constructor
=cut
sub new {
my $self = shift->SUPER::new( @_ > 1 ? {@_} : $_[0] );
return $self;
}
mpute;
use Moose;
our $VERSION = '1.1002'; # VERSION
use Carp;
use HTTP::Request;
use JSON qw(from_json to_json);
use LWP;
has auth_url => (is => 'rw', required => 1);
has user => (is =
params);
my $res = $self->_get($self->_url("/servers", $params{detail}, $q));
return from_json($res->content)->{servers};
}
sub get_server {
my ($self, $id) = @_;
croak "Invalid serve
elf->_get($self->_url("/servers/$id"));
return undef unless $res->is_success;
return from_json($res->content)->{server};
}
sub get_servers_by_name {
my ($self, $name) = @_;
my $server
package Net::OpenStack::Compute::AuthRole;
use Moose::Role;
use JSON qw(from_json to_json);
requires qw(
auth_url
user
password
project_id
region
service_name
is_rax_auth
content_type => 'application/json', content => to_json($auth_data));
die $res->status_line . "\n" . $res->content unless $res->is_success;
my $data = from_json($res->content);
my $token
Server::JSONRPC;
use strict;
use warnings;
use base qw/Class::Accessor::Fast/;
our $VERSION = '0.05';
use POE qw/
Filter::Line
/;
use JSON;
=head1 NAME
POE::Component::Server::JSONRPC - PO
E tcp or http based JSON-RPC server
=head1 SYNOPSIS
#http version:
POE::Component::Server::JSONRPC::Http->new(
Port => 3000,
Handler => {
'echo' => 'echo',
Server::JSONRPC::Tcp->new(
Port => 3000,
Handler => {
'echo' => 'echo',
'sum' => 'sum',
},
);
sub echo {
my ($kernel, $jsonrpc, $id
der => '_build_endpoints',
);
sub _build_endpoints {
my $self = shift;
# TODO should decode the content
# $self->_endpoints(decode_json($self->client->GET($self->_self_endpoint)));
}
1;
package WWW::Socrata;
use strict;
use warnings;
use WWW::Curl::Easy;
use JSON;
use URI::Escape;
use Carp;
our $VERSION = '0.02';
sub new {
my $class = shift;
my $rh_params = shift;
my $self = {}
path;
#define default headers to send
my @headers = (
'Accept: application/json',
'Content-type: application/json',
"X-App-Token: " . $self->{app_token},
);
#define parameters
my $qstring
i++){
shift @response;
}
$response_body = join("\n", @response);
$obj_response = decode_json($response_body);
return $obj_response;
} else {
croak "An error happened: " . $curl->strerro
ings;
use strict;
use Vimana;
use Vimana::Util;
use JSON::PP;
use File::Path;
use Digest::MD5 qw(md5_hex);
use YAML;
sub new_json {
return JSON::PP->new->allow_singlequote(1);
}
sub record_dir {
open FH , "<" , $record_file;
local $/;
my $json = <FH>;
close FH;
my $record;
eval { $record = new_json()->decode( $json ) };
if( $@ ) {
# try to load YAML. (old r
$pkgname );
return 0 if -f $record_file;
open FH , ">" , $record_file;
print FH new_json()->encode( $record );
close FH;
#return YAML::DumpFile( $record_file , $record );
}
erl},
));
return $OK->();
}
=head2 C<meta>
Returns the contents of the F<META.yml> or F<META.json> files as parsed by L<Parse::CPAN::Meta>.
=cut
sub meta {
my $self = shift;
my $mod = $self-
return $meta if defined $meta;
my $extract_dir = $mod->status->extract;
for my $name (qw<META.json META.yml>) {
my $meta_file = File::Spec->catdir($extract_dir, $name);
next unless -e $meta_fi
Log::Message::Structured::Component::Hostname
Log::Message::Structured::Stringify::AsJSON
/;
has foo => ( is => 'ro', required => 1 );
... elsewhere ...
use aliased 'My
either pass around in your application, log in a traditional
manor as a log line, or serialize to JSON or YAML for transmission over the
network.
=head1 COMPONENTS
The consuming class can include co
m L<Log::Message::Structured::Stringify::Sprintf>
=item L<Log::Message::Structured::Stringify::AsJSON>
=item L<Log::Message::Structured::Stringify::AsYAML>
=back
=head1 AUTHOR AND COPYRIGHT
Tomas