::AllegroGraph::Server4;
use strict;
use warnings;
use base qw(RDF::AllegroGraph::Server);
use JSON;
use Data::Dumper;
use RDF::AllegroGraph::Catalog4;
use HTTP::Request::Common;
use HTTP::Status;
gs');
die "protocol error: ".$resp->status_line unless $resp->is_success;
my $cats = from_json ($resp->content);
return
map { $_ => RDF::AllegroGraph::Catalog4->new (NAME => $_, SERVER =
I;
use warnings;
use strict;
use utf8;
use Digest::MD5 qw(md5 md5_hex);
use WWW::Mechanize;
use JSON;
=pod
=head1 NAME
VKontakte::API - Module for login into vkontakte.ru and sending requests
=h
;
$params->{'method'} = $method;
$params->{'timestamp'} = time();
$params->{'format'} = 'json';
$params->{'rnd'} = int(rand()*10000);
my $sig = defined $self->{'mid'} ? $self->{'mid'} :
_get_contents($query);
my $response = $mech->content();
utf8::encode($response);
return decode_json($response);
}
=head2 _params
prepares parameters for request
=cut
sub _params {
my $self =
Spec::Functions qw<catdir catfile rel2abs>;
use File::Temp qw<tempdir>;
use POE;
use POE::Filter::JSON;
use POE::Filter::Reference;
use POE::Filter::Stream;
use POE::Wheel::SocketFactory;
use POE::Whe
POE::Wheel::ReadWrite->new(
Handle => $handle,
Filter => POE::Filter::JSON->new(),
InputEvent => 'client_read',
FlushedEvent => 'client_write',
Er
= $self->{clients}{$wheel_id};
if (ref $input ne 'HASH') {
$client->put({ error => 'JSON data must be a hash' });
}
elsif (!defined $input->{lang}) {
$client->put({ error
h;
use warnings;
use strict;
use utf8;
use Digest::MD5 qw(md5 md5_hex);
use WWW::Mechanize;
use JSON;
=pod
=head1 NAME
VKontakte::API::OAuth - Module for login into vkontakte.ru using OAuth 2.0 a
$mech->get($query);
my $response = $mech->content();
utf8::encode($response);
my $h=decode_json($response);
return undef unless(defined $h->{'access_token'});
$self->{'access_token'}=$h-
= $mech->get($query);
my $response = $mech->content();
utf8::encode($response);
return decode_json($response);
}
sub _params {
my $self = shift;
my $params = shift;
return unless ( ref $par
nings;
use base qw(RDF::AllegroGraph::Repository);
use Data::Dumper;
use feature "switch";
use JSON;
use URI::Escape qw/uri_escape_utf8/;
use HTTP::Request::Common;
=pod
=head1 NAME
RDF::Allegr
$ua->post ($self->{path} . '/statements',
'Content-Type' => 'application/json', 'Content' => encode_json (\@stmts) );
die "protocol error: ".$resp->status_line.' ('.$resp->content.')' un
->new (PUT => $self->{path} . '/statements',
[ 'Content-Type' => 'application/json' ], encode_json (\@stmts));
my $resp = $ua->request ($requ);
die "protocol error: ".$resp->status_lin
DARK_GREEN ORANGE TEAL BROWN);
use POE::Component::IRC::Plugin qw(PCI_EAT_NONE);
use POE::Filter::JSON;
use POE::Wheel::ReadWrite;
use POE::Wheel::SocketFactory;
sub new {
my ($package, %args) =
} = POE::Wheel::ReadWrite->new(
Handle => $socket,
Filter => POE::Filter::JSON->new(),
InputEvent => 'eval_read',
ErrorEvent => 'eval_error',
);
$eval-
package WebService::Futu;
use warnings;
use strict;
use LWP::UserAgent;
use JSON::XS;
use HTTP::Status qw(:constants :is status_message);
use HTTP::Cookies;
use Data::Dumper;
=head1 NAME
WebServi
$content) = @_;
my $json_content = encode_json($content) if $content;
my $max = 10;
for (my $i = 0; $i < $max; $i++){
my $body = $self->_perform($method, $query, $json_content);
# run co
mmand
if ($body->code eq HTTP_OK) {
if ($body->content){
return decode_json($body->content)
}else{
return {};
};
} elsif ($body->code eq HTTP_UNAUTHORIZED) {
# mak
$ua->post ($self->{path} . '/statements',
'Content-Type' => 'application/json', 'Content' => encode_json (\@stmts) );
die "protocol error: ".$resp->status_line.' ('.$resp->content.')' un
->new (PUT => $self->{path} . '/statements',
[ 'Content-Type' => 'application/json' ], encode_json (\@stmts));
my $resp = $ua->request ($requ);
die "protocol error: ".$resp->status_lin
OST => $self->{path} . '/statements/delete',
[ 'Content-Type' => 'application/json' ], encode_json (\@facts));
my $resp = $ua->request ($requ);
die "protocol error: ".$resp->status_lin
if ($d =~ q|^<(.*)>$|) {
return $1;
} elsif ($d =~ q|^"(.*)"$|) {
return $1;
} elsif (JSON::XS::is_bool $d) {
return $d;
# return JSON::XS::true == $d;
} else {
return $d;
}
}
1;
ig.json));
produce ./etc/config.json on unix
=cut
=head3 file_io, dir_io
append filesystem objects to IO::Easy subclass object
my $config = IO::Easy::Dir->current->file_io (qw(etc config.json));
nfig.json on unix, blessed into IO::Easy::File
=cut
=head3 up, parent
directory container for io object
my $config = IO::Easy::Dir->current->append (qw(etc config.json)); # './etc/config.json'
m
# '.'
my $config = $current->append (qw(etc config.json)); # './etc/config.json'
my $config_rel = $config->rel_path ($current); # 'etc/config.json'
=cut
=head3 path_components
path, split by file
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.04';
$VERSION = eval $VERSION;
sub new {
my
return unless $res->is_success;
# Change the content type of the response from 'application/json' so
# HTTP::Message will decode the character encoding.
$res->content_type('text/plain');
my $content = $res->decoded_content;
return unless $content;
my $data = eval { from_json($content) };
return unless $data;
return $self->{id} = $data->{resourceSets}[0]{resource
}
my $assets = $response->content;
# TRACE($assets) if DEBUG;
use JSON;
$assets = eval { decode_json($assets) };
if ($@) {
TRACE($@) if DEBUG;
$self->main->error
t_lexicon( $lexicon );
$lme->write_po($pofile);
}
=pod
package MsgEntry;
use Any::Moose;
use JSON::XS;
use overload
'""' => \&to_string,
'%{}' => \&to_hash;
has id => ( is => 'rw', isa
lang => $self->lang,
msgid => $self->msgid,
msgstr => $self->msgstr,
);
}
sub to_string {
my $self = shift;
return encode_json( { $self->to_hash } );
}
=cut
1;
d" => "msgstr"
....
);
?>
....
For JSON
en.json:
{
"msgid..." : "msgstr"
...
};
zh_tw.json:
{
....
};
Static JS
var dict;
g) = ($pofile =~ m{(\w+)\.po$} ); # get en_US or zh_TW ... etc
my $ext = $type; # "json , js, pl, pm, php";
my $outfile = File::Spec->join( $output_dir , "$lang.$ext" );
if( $type eq 'json' ) {
use JSON::XS;
print FH encode_json( \%entries );
}
elsif ( $type eq 'js' ) {
use JSON::XS;
package Geo::Coder::Mappy;
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.02';
$VERSION = eval $VERSION;
sub new {
my ($c
=> $self->{token},
fullAddress => $location,
'opt.format' => 'json',
'opt.interactive' => 1,
'opt.language' => 'ENG',
'opt.xmlOutput' =
my $content = $res->decoded_content;
return unless $content;
my $data = eval { from_json($content) };
return unless $data;
# Result is a list only if there is more than one item
ose;
use Digest::SHA qw/hmac_sha256/;
use Digest::MD5 qw/md5_hex/;
use MIME::Base64::URLSafe;
use JSON;
use Carp qw/croak/;
use namespace::autoclean;
has canvas_param => (
isa => 'Str',
is => 'ro'
d) = split('\.', $facebook_data);
my $sig = urlsafe_b64decode($encoded_sig);
my $data = decode_json(urlsafe_b64decode($payload));
my $expected_sig = hmac_sha256($payload, $app_secret);
if ($sig
is => 'ro',
isa => File,
required => 1,
default => "$BASE/config.json"
);
has sources => (
is => 'rw',
isa => UriArray,
coerce => 1,
head1 USAGE
# first run
$ syndicator --init
# add your own feeds
$ vim ~/.syndicator/config.json
# run
$ syndicator 2> errors.log
$ syndicator --config=config.any --db=sqlite.db
=head2 EX
ile::Path qw/mkpath/;
use Locale::Maketext::Extract;
use Getopt::Long;
use Exporter 'import';
use JSON::XS;
use YAML::XS;
use File::Basename;
use Locale::Maketext::Extract;
use App::I18N::Logger;
use
Plugin::PPI' => [ 'pm','pl' ],
'tt2' => [ ],
# 'perl' => ['pl','pm','js','json'],
'perl' => [ '*' ], # _( ) , gettext( ) , loc( ) ...
'mason' => [ ] ,
func => 'save',
assetId => $asset->{assetId},
props => encode_json($asset),
}
);
unless ( $response->header('Padre-Plugin-WebGUI') ) {
my $e
= shift;
my $content = shift;
# TRACE($content) if DEBUG;
use JSON;
my $asset = eval { decode_json($content) };
if ($@) {
TRACE($@) if DEBUG;
warn $@;
trict;
use warnings;
package Module::Build::JSONMETA;
BEGIN {
our $VERSION = '7.001';
}
=head1 NAME
Module::Build::JSONMETA - (depreacted) write META.json instead of META.yml
=head1 SYNOPSIS
B<Ach
pec> JSON files.
This interface may be changed in the future if someone with more Module::Build
expertise steps forward.
----- in Build.PL -----
use Module::Build;
use Module::Build::JSONMETA
;
my $class = Module::Build->subclass(
code => Module::Build::JSONMETA->code,
);
my $build = $class->new( ... );
$build->create_build_script;
=cut
my $CODE;
BEGIN {
$CODE = <<'END_C