========
sub get_converter # ($function)
{
my $convert = ($_[0] =~ s/:JSON$//
? 'WebService::NFSN::decode_json'
: '');
return $convert;
} # end get_converter
#-
package Acme::JWT;
use strict;
use warnings;
our $VERSION = '0.04';
use JSON qw/decode_json encode_json/;
use MIME::Base64 qw/encode_base64url decode_base64url/;
use Try::Tiny;
use Digest::SHA qw/hma
=> $algorithm,
};
push(@$segments, encode_base64url(encode_json($header)));
push(@$segments, encode_base64url(encode_json($payload)));
my $signing_input = join('.', @$segments);
un
$payload;
my $signature;
try {
$header = decode_json(decode_base64url($header_segment));
$payload = decode_json(decode_base64url($payload_segment));
$signature = decod
tt',
);
Later:
my $json = JSON::XS->new->utf8;
my $obj = My::Class->new(rr=>'foo');
my $str = $json->encode($obj->as_hash);
my $obj2 = My::Class->new_in_place($json->decode($str));
# $
html\+xml}i;
return WWW::DataWiki->FMT_JSON if $format =~ m{^(RDF[\s_/-]?)?JSON}i;
return WWW::DataWiki->FMT_JSON if $format =~ m{^application/json}i;
return WWW::DataWiki->FMT_XML if
pplication/sparql-query, text/n3, text/turtle, text/plain, application/rdf+xml;q=0.5, application/json;q=0.1, application/xhtml+xml;q=0.1, text/html;q=0.1'});
}
}
action container_OPTIONS
{
my
=======
BEGIN {
__PACKAGE__->_define(
type => 'email',
methods => {
'listForwards:JSON' => [],
removeForward => [qw(forward)],
setForward => [qw(forward dest_email)],
e; charset=utf-8',
'rdf' => 'application/rdf+xml; charset=utf-8',
'json' => 'application/json',
}->{$variant} || 'application/octet-stream';
$headers{'Content-Typ
xml/i) { $parser = RDF::Trine::Parser::RDFXML->new; }
when (/json/i) { $parser = RDF::Trine::Parser::RDFJSON->new; }
when (/text.plain/i) { $parser = RDF::Trine::Parser::NTrip
Triples), application/xhtml+xml (i.e. XHTML+RDFa 1.0), application/rdf+xml and application/json (i.e. RDF/JSON).');
}
}
# Check it's syntactically sound
my $model;
if (
FMT_XHTML => 'XHTML',
FMT_HTML => 'HTML',
FMT_JSON => 'RDFJSON',
};
use constant {
FMT_RS_XML => 'xml',
FMT_RS_JSON => 'json',
FMT_RS_TEXT => 'txt',
FMT_RS_HTML => 'html',
point. HTTP content negotiation serves up graph data as HTML, Turtle,
RDF/XML, JSON; and query results as HTML, XML, JSON, CSV or tab-delimited data.
WWW::DataWiki is fully RESTful, using HTTP B<GET>
package Net::ZooTool::Utils;
use Moose::Role;
use JSON::XS;
use Carp;
use Data::Dumper;
use Digest::SHA1 qw/sha1_hex/;
use WWW::Curl::Easy;
use namespace::autoclean;
our $VERSION = '0.003';
=head
URLINFO_HTTP_CODE);
# judge result and next action based on $response_code
return JSON::XS->new->utf8->decode($response_body);
}
else {
carp( "An error happened: $ret
Load a JSON package and define our decode_json function:
BEGIN
{
if (_eval "use JSON::XS ()") {
# Can't find JSON::XS, try JSON (2.0 or later):
_eval_or_die "use JSON qw(decode_json)";
}
if ($JSON::XS::VERSION >= 2) {
*decode_json = \&JSON::XS::decode_json;
} else {
*decode_json = \&JSON::XS::from_json; # old name for decode_json
} # end else found JSON::XS pri
or to version 2.0
} # end else we were able to load JSON::XS
} # end BEGIN
#=====================================================================
# Define exceptions:
use Exception::Class (
'Web
equires <<_END_
Moose
Xyzzy 1.02
JSON 2
_END_
Is equivalent to:
requires 'Moose' => 0
requires 'Xyzzy' => 1.02
requires 'JSON' => 2
=head2 parse_requires $kind, $documen
JSON 2 can substitute for JSON::XS:
sub prereq_failures
{
my $self = shift @_;
my $out = $self->SUPER::prereq_failures(@_);
return $out unless $out;
if (my $attrib = $out->{requires}{'JSON
my $message;
eval "use JSON 2 ();";
if (not $@) {
# JSON 2.0 or later is an acceptable replacement for JSON::XS:
delete $out->{requires}{'JSON::XS'};
# Clean out empty
JSON 2.0 or later can substitute for JSON::XS, but its pure-Perl
implementation is slower, and you don't have it installed either.
} # end else we couldn't load JSON 2 either
} # end if JSON
>uri, 'n3'), ')',
' (', a(-rel=>'rel:alternate', -href=>$ver->formatted_page_iri('json')->uri, 'json'), ')',
br(
-property => 'awol:published',
-content => $publ
ey are optimised for serialisation, see
L<Data::MultiValued::UglySerializationHelperRole> and F<t/json.t>.
=item *
you get accessors generated for your Moose attributes just by setting
a trait
=ite
fresh retry)],
methods => {
addRR => [qw(name type data ttl?)],
'listRRs:JSON' => [qw(name? type? data?)],
removeRR => [qw(name type data)],
updateSerial =
ry.)
BEGIN { $| = 1; print "1..3\n"; }
END {print "not ok 1\n" unless $loaded;}
use GD;
use JSON::Parse;
$loaded = 1;
print "ok 1\n";
######################### End of black magic.
# Insert
package Net::GraphSpace::AttributesToJSON;
use Moose::Role;
use v5.10;
sub TO_JSON {
my ($self) = @_;
my @attrs = $self->meta->get_all_attributes;
return { map $self->_affinitize($_), @at
}
return $name => $value;
}
1;
__END__
=pod
=head1 NAME
Net::GraphSpace::AttributesToJSON
=head1 VERSION
version 0.0009
=head1 AUTHOR
Naveed Massjouni <naveedm9@gmail.com>
=head1 COP
ET POST);
use LWP::ConnCache;
use Digest::SHA1;
use Params::Validate qw(validate);
use Carp;
use JSON::Any;
use fields qw(
base
key
secret
);
use constant {
SCOPE_DAILY => 1,
S
2,
SCOPE_OVERALL => 3,
SCOPE_YESTERDAY => 4,
};
our $connectionCacheLimit = 50;
our $json = JSON::Any->new(utf8=>1);
{
my $cache;
sub _getCache
{
$cache ||= LWP::ConnCac
,
scope => 0,
});
my $response = $self->_get("ranks", %args);
return $json->jsonToObj($response->content);
}
sub scoreSave
{
my $self = shift;
my %args = @_;
vali
ler);
use URI;
use URI::Query;
use LWP::UserAgent;
use Plack::Middleware::OAuth::AccessToken;
use JSON::Any;
use warnings;
use strict;
sub build_args {
my ($self,$code) = @_;
my $config = $se
sponse->header('Content-Type');
my $atkn;
if( $content_type =~ m{json} || $content_type =~ m{javascript} ) {
my $params = JSON::Any->new->decode( $response_content );
$atkn = Plack::Midd
ture to Image: A supplemental script for Signature Pad that
generates an image of the signature's JSON output server-side using PHP.
project ca.thomasjbradley.applications.signaturetoimage
author Th
#(198)] [--ymax=#(55)] [--pen_color='r,g,b'(20,83,148)] [--background_color='r,g,b'(255,255,255)] json-file|-
-or-
cat jason-file | signature-to-image.pl [--multiplier=#(5)] [--penwidth=#(2)] [--xma
efile.png
-or-
#!/usr/bin/perl -w
require "signature-to-image.pl"
my ($img, $err) = &sig2png($json_image [, multiplier => #(5)] [, penwidth => #(2)] [, xmax => #(198)] [, ymax => #(55)] [, pen_col