eption
register_exception('ProfileInvalidFormat',
message_pattern => "Unknown format use yml, json or pl: %s"
);
my $dfv;
my $results;
register form_validator_error => sub {
$results =
ile;
my $available_deserializer = {
json => sub {
my ( $file ) = @_;
load JSON::Syck;
my $data = JSON::Syck::LoadFile($file);
return $dat
- name
- subject
- body
msgs:
missing: Not here
Example with json format:
{
"profile_contact": {
"required": [
"name",
se WWW::Bizowie::API::Response;
use LWP::UserAgent;
use HTTP::Request::Common;
use Try::Tiny;
use JSON;
our $VERSION = '0.02';
=head1 NAME
WWW::Bizowie::API - Perl interface to the Bizowie.com API
die "[Bizowie::API] fatal error: no method given" unless $method;
my $request = encode_json($params || { });
my $q = $self->{ua}->request(POST("https://${site}/bz/api/$method",
);
my $o;
{
local $SIG{__DIE__} = sub { };
try {
$o = decode_json($q->decoded_content);
} catch {
$o = { unprocessed => 1 };
};
ad1 VERSION
version 0.02
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('api.json');
$client->enable( 'BaseUrl',
base_url => 'www.perl.org',
);
=head1 NAME
Net:
se JSON;
use Carp qw(croak);
our $VERSION = v0.16.0;
=head1 Name
PGXN::Meta::Validator - Validate PGXN distribution metadata structures
=head1 Synopsis
my $struct = decode_json_file('META.json')
lass;
}
=head3 C<load_file>
my $meta = PGXN::Meta::Validator->load_file('META.json');
Reads in the specified JSON file and passes the resulting data structure to
C<new()>, returning the resulting
nts are not valid
JSON.
=cut
sub load_file {
my ($class, $file) = @_;
croak "load_file() requires a valid, readable filename"
unless -r $file;
$class->new(JSON->new->decode(do
GPSD daemon.
=head1 METHODS
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Return the parent Net::GPSD object
=head2 message
Textual error message.
e;
use WWW::Billomat::Client;
use WWW::Billomat::Invoice;
use WWW::Billomat::Invoice::Item;
use JSON;
=head1 NAME
WWW::Billomat - API access to Billomat services
=head1 VERSION
Version 0.01
=cu
return undef;
}
sub _create_object {
my($self, $object) = @_;
my $body = $self->_to_json($object);
# warn "BODY=$body\n";
# $body = Encode::encode('ASCII', $body, Encode::FB_XMLC
# 'Content-Type' => 'application/xml; charset=utf-8'
'Content-Type' => 'application/json'
}
);
if($response->responseCode() == 201) {
return $self->_get_object_fr
GPSD daemon.
=head1 METHODS
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Return the parent L<Net::GPSD3> object
=head2 time
=head2 timestamp
=he
t
sub fix {shift->Fixes->[0]};
sub tpv {shift->Fixes->[0]};
=head2 Fixes
Object wrapper around JSON data
my $fix=$poll->Fixes #isa [] of Net::GPSD3::Return::TPV objects
my @fix=$poll->Fixes #i
method consistant
=cut
sub sky {shift->Skyviews->[0]};
=head2 Skyviews
Object wrapper around JSON data
my $sky=$poll->Skyviews #isa [] of Net::GPSD3::Return::SKY objects
my @sky=$poll->Skyvi
TION
Provides a Perl object interface to the SKY object returned by the GPSD daemon.
An example JSON object:
=head3 Protcol 3.1 versions
{
"class":"SKY",
"tag":"MID4",
"device":"/dev
}
=head1 METHODS PROPERTIES
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Return the parent Net::GPSD object
=head2 device
=cut
sub device {shift
SD daemon.
An example JSON string:
{"PRN":15,"el":77,"az":123,"ss":0, "used":false},
=head1 METHODS
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Random Number Identifier
=cut
sub PRN {shift->{"PRN"}};
*prn=\&PRN;
=head2 used
Returns a L<JSON::XS::Boolean> true or false object.
=cut
sub used {shift->{"used"}};
=head2 az, azimuth
Retur
GPSD daemon.
=head1 METHODS
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Return the parent Net::GPSD object
=head2 devices
Returns a list of devi
n;
use Data::Dumper;
use LWP::UserAgent;
use LWP::Protocol::https;
use HTTP::Request::Common;
use JSON;
use Data::Printer;
use URI::Escape;
use File::Util qw(SL);
use Encode qw(is_utf8 _utf8_off);
use
. '/buddy/send.json';
our $API_BUDDY = $API_BASE . '/profile/buddy.json';
our $API_GROUP_MEMBERS = $API_BASE . '/group/members.json';
our $API_GROUP_SEND = $API_BASE . '/group/send.json';
our $API_GRO
UP_EXIT = $API_BASE . '/group/exit.json';
our $API_FILE_DOWNLOAD = $API_BASE . '/file/download.json';
our $API_SEND_LENGTH = 1000;
sub BUILD {
my $self = shift;
}
sub _call_file {
my $self = shif
object interface to the Time-Velocity-Position (TVP) object returned by the GPSD daemon.
Example JSON objects:
=head3 Protocol 3.1 Versions
{
"class":"TPV",
"tag":"MID2",
"device":"/d
}
=head1 METHODS PROPERTIES
=head2 class
Returns the object class
=head2 string
Returns the JSON string
=head2 parent
Return the parent Net::GPSD object
=head2 device
Name of originating dev
eate.pl model ModelName Riak http:/192.168.0.1:8089 900
# In you controller use
my $coder = JSON::XS->new->utf8->pretty->allow_nonref;
#
# Set bucket
#
$c->model("ModelName")->bucket('Buck
eate
Creates a new key/value pair
$c->model("ModelName")->create({ key => 'keyname', value => $json_data });
=head2 delete
Deletes a key/value pair
=head2 get
Get a key/value pair from the ri
head2 update
Update a key/value pair
$c->model('ModelName')->update( { key => 'key', value => $json_data } );
=head2 dw
Get or set the number of partitions to wait for write confirmation
=head2
=cut
sub parent {shift->{"parent"}};
=head2 class
Returns the class string for the particular JSON message. Classes in all upper case are from gpsd. Classes with initial capital letter are from
n classes should use camel case.
=cut
sub class {shift->{"class"}};
=head2 string
This is the JSON string as passed over the TCP connection.
=cut
sub string {shift->{"string"}};
=head1 BUGS
Lo
= 1, @items ; ## insert
## Sample code for uploading files:
use google ;
use MimeTypes ;
use JSON ;
use MIME::Entity ;
use File::Basename ;
use Getopt::Std ;
getopts( 'op:t' ) ;
$token = Google
plication/vnd.google-apps.folder' ;
my $content = JSON::to_json( $doc ) ;
$out = $token->content( POST => Google::Drive->url,
'application/json',
$content ) ;
do 'perlterm.pl' ;
exit ;
}
or die "Unknown Mime Type" ;
$content = JSON::to_json( $doc ) ;
$m = MIME::Entity->build( Type => 'multipart/mixed' ) ;
$m->attach( Type => 'application/json',
Encoding => '7bit',
Data => $cont
age Google::OAuth ;
use base NoSQL::PL2SQL ;
use Google::OAuth::Config ;
use LWP::UserAgent ;
use JSON ;
use 5.008009;
use strict;
use warnings;
require Exporter;
push @Google::OAuth::ISA,
qw( E
ntent = $self->response( @_ )->content ;
return $content unless $content =~ /^{/s ;
return JSON::from_json( $content ) ;
}
sub headers {
shift @_ if $_[0] eq __PACKAGE__ ;
shift @_ if ref $_[0]
HTTP::Response->content >> and returns the body of the
HTTP response.
If the response body is a JSON definition, C<content()> returns a
perl object based on that definition. Otherwise it returns a
Google::OAuth::CGI->new( $self->{args} )->query_string
) ) ;
## returns a string on success, JSON on failure - crazy huh?
return $out if ref $out ;
return { text => $out } unless $out =~ /acce
ethod definition.
Facebook uses an HTTP GET request instead of a POST.
Facebook does not return JSON when a token request succeeds.
The overridden method copies the token into an element named
I<f
package Net::GPSD3;
use strict;
use warnings;
use base qw{Net::GPSD3::Base};
use JSON::XS qw{};
use IO::Socket::INET6 qw{};
use Net::GPSD3::Return::Unknown;
use Net::GPSD3::Cache;
use DateTime
ACKAGE__;
=head1 NAME
Net::GPSD3 - Interface to the gpsd server daemon protocol versions 3 (JSON).
=head1 SYNOPSIS
=head2 Watch Interface
use Net::GPSD3;
my $gpsd=Net::GPSD3->new;
an open source GPS daemon from http://www.catb.org/gpsd/ Support for Version 3 of the protocol (JSON) was added to the daemon in version 2.90. If your daemon is before 2.90 (protocol 2.X), please u
$self->is_admin) {
# force generate META.json
CPAN::Meta->load_file('META.yml')->save('META.json');
print "Regenerate META.json and META.yml using cpanfile\n";
$file->
merge_meta('META.yml');
$file->merge_meta('META.json');
}
for my $metafile (grep -e, qw(MYMETA.yml MYMETA.json)) {
print "Merging cpanfile prereqs to $metafile\n";
$fi
package jQuery::File::Upload::Imager;
use 5.008008;
use strict;
use warnings;
use CGI;
use JSON::XS;
use Net::SSH2;
use Net::SSH2::SFTP;
use Imager;
use Cwd 'abs_path';
use Digest::MD5 qw(md5_hex);
estion
if ($self->ctx->req->headers->header('Accept') =~ qr(application/json) ) {
$content_type = 'application/json';
}
$self->ctx->stash->{current_view} = '';
$self->ctx->res->conte
');
}
#they should provide image=y or image=n if image
my $json = JSON::XS->new->ascii->pretty->allow_nonref;
$self->{output} = $json->encode({files => \@arr});
}
sub _no_ext {
my $self = shift