bject_id {
my ($self, $object_id) = @_;
return sprintf('%s&search=object_number=%s&output=json', $self->base_query, $object_id);
}
sub priref {
my ($self, $priref) = @_;
return sprint
f('%s&search=priref=%s', $self->base_query, $priref);
}
sub all {
my ($self) = @_;
return sprintf('%s&search=all&output=json', $self->base_query);
}
1;
__END__
_JSON {
my ($self) = @_;
my $json = {};
$json->{status} = $self->status();
$json->{statusText} = $self->status_text();
$json->{httpVersion} = $self->http_version();
$json
$json->{headers} = [ $self->headers() ];
$json->{content} = $self->content();
$json->{redirectURL} = $self->redirect_url();
if ( defined $self->headers_size() ) {
$json->
$json->{headersSize} = _DOES_NOT_APPLY();
}
$json->{headersSize} += 0;
if ( defined $self->body_size() ) {
$json->{bodySize} = $self->body_size();
}
else {
$json->
sub TO_JSON {
my ($self) = @_;
my $json = {};
if ( defined $self->on_content_load() ) {
$json->{onContentLoad} = $self->on_content_load();
}
else {
$json->{onCont
on_load() ) {
$json->{onLoad} = $self->on_load();
}
else {
$json->{onLoad} = _DOES_NOT_APPLY();
}
if ( defined $self->comment() ) {
$json->{comment} = $self->co
( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields
$json->{$key} = $self->{$key};
}
}
return $json;
}
1;
__END__
=head1 NAME
Archive::Har::Page::PageTimings - Repre
value starts with '[' or '{' then it
# will be assumed to be JSON and will be JSON-decoded.
sub _convert_args_to_struct {
require JSON::MaybeXS;
my $args = shift;
for my $k (keys %$args)
unless $args->{$k} =~ /\A(?:\[|\{)/;
eval { $args->{$k} = JSON::MaybeXS::decode_json($args->{$k}) };
die "Invalid JSON in '$k' argument: $@\n" if $@;
}
}
sub _api {
require XM
ltCode}, $fault->{faultString}];
}
[200, "OK", $call->result, {'cmdline.default_format'=>'json-pretty'}];
}
our %API_Methods = (
# Posts
'wp.getPost' => {
args => [
AC::Yenta::Debug 'store_server';
use AC::Yenta::Store;
use AC::Yenta::Config;
use AC::Dumper;
use JSON;
use Digest::SHA 'sha1_base64';
require 'AC/protobuf/yenta_getset.pl';
require 'AC/protobuf/yenta
y $cont = shift;
return 1 unless $meta && $meta =~ /^\{/;
eval {
$meta = decode_json($meta);
};
return 1 if $@;
if( $meta->{sha1} ){
my $chk = sha1_base64( $$con
;
use AC::Yenta::Conf;
use AC::DC::Protocol;
use AC::Import;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Digest::SHA 'sha1';
use Socket;
use strict;
require 'AC/protobuf/yenta_check.pl';
require '
me->{server_file});
local $/ = "\n";
while(<$f>){
chop;
my $data = decode_json( $_ );
next unless grep { $_ eq $map } @{ $data->{map} };
if( $data->{is_local} )
se AC::Yenta::Config;
use AC::Yenta::MySelf;
use AC::Dumper;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Socket;
require 'AC/protobuf/yenta_status.pl';
use strict;
my $KEEPDOWN = 1800; # keep data
yenta' ){
$data->{map} = $pd->{map};
}
print FILE encode_json( $data ), "\n";
}
close FILE;
unless( rename("$file.tmp", $file) ){
TO_JSON {
my ($self) = @_;
my $json = {};
$json->{name} = $self->name();
if ( !defined $json->{name} ) {
$json->{name} = q[]; # HAR Viewer insists on this
}
$json->{
value} = $self->value();
if ( defined $self->comment() ) {
$json->{comment} = $self->comment();
}
foreach my $key ( sort { $a cmp $b } keys %{$self} ) {
next if ( !defined
( $key =~ /^_[[:alnum:]]+$/smx ) { # private fields
$json->{$key} = $self->{$key};
}
}
return $json;
}
1;
__DATA__
=head1 NAME
Archive::Har::Entry::Request::QueryStr
b TO_JSON {
my ($self) = @_;
my $json = {};
$json->{method} = $self->method();
$json->{url} = $self->url();
$json->{httpVersion} = $self->http_version();
$json->{c
$self->cookies() ];
$json->{headers} = [ $self->headers() ];
$json->{queryString} = [ $self->query_string() ];
if ( defined $self->post_data() ) {
$json->{postData} = $self->po
_size() ) {
$json->{bodySize} = $self->body_size();
if ( $self->body_size() == 0 ) {
delete $json->{postData};
}
}
else {
$json->{bodySize} = _DOES_
package Archive::Har::Entry::Cookie;
use warnings;
use strict;
use JSON();
use Carp();
our $VERSION = '0.21';
sub new {
my ( $class, $params ) = @_;
my $self = {};
bless $self, $class;
$old;
}
sub TO_JSON {
my ($self) = @_;
my $json = {};
$json->{name} = $self->name();
$json->{value} = $self->value();
if ( defined $self->path() ) {
$json->{path} = $self
$json->{domain} = $self->domain();
}
if ( defined $self->expires() ) {
$json->{expires} = $self->expires();
}
if ( defined $self->http_only() ) {
$json->{httpOn
dowsocks rfc1928 Great Firewall Internet censorship in China
#
# Modify the config.json sample, save it to config.json. Run ssserver.pl on
# server, run ssclient.pl on localhost. Config your browser t
through the great firewall of
# china.
use 5.006;
use strict;
use warnings;
use Getopt::Std;
use JSON;
use Net::Shadowsocks::Client;
my $version = "0.9.3.2";
sub main::HELP_MESSAGE()
{
print("U
ctr rc6-256-ofb\n");
print("\tspritz\n");
printf("\t-c CONFIG\t\tFull path of your config.json file\n");
print("\t-h, --help\t\tDisplay this help screen\n");
print("\t-v, --version\t\t
n $old;
}
sub TO_JSON {
my ($self) = @_;
my $json = {};
if ( defined $self->blocked() ) {
$json->{blocked} = $self->blocked() + 0;
}
else {
$json->{blocked} = _DOE
$self->dns() ) {
$json->{dns} = $self->dns() + 0;
}
else {
$json->{dns} = _DOES_NOT_APPLY();
}
if ( defined $self->connect() ) {
$json->{connect} = $self->conne
else {
$json->{connect} = _DOES_NOT_APPLY();
}
$json->{send} = ( $self->send() || 0 ) + 0;
$json->{wait} = ( $self->wait() || 0 ) + 0;
$json->{receive} = ( $sel
->new('config' => 'ironmq.json');
my $queue = $client->create_and_get_queue( 'name' => $queue_name );
run_me( { 'backend' => 'IronMQ', 'options' => { 'config' => 'ironmq.json' } } );
run_me( {
'backend' => 'IronMQ',
'options' => {
'config' => 'ironmq.json',
'queue' => $queue_name,
},
} );
$client->delete_queue( 'name' => $queue_name );
done_tes
or above library.
=head1 SETUP MAP
C<Map::Tube v3.22> or above now supports map data in XML and JSON format. Here is
the Structure of map in XML format:
<?xml version="1.0" encoding="UTF-8"?>
.
.....
.....
.....
</stations>
</tube>
And same in JSON format:
{
"name" : "Your-Map-Name",
"lines" : {
"line" : [
line="L1:8" link="L07" />
</stations>
</tube>
Next is the JSON representation C<sample.json> of the above map:
{
"name" : "Sample",
"lines" : { "line
{
my ($self, $map) = @_;
$map //= {
'text/html' => 'html',
'application/json' => 'json',
'text/xml' => 'xml',
'application/xml' => 'xml',
};
die "invalid typ
rvices.
=head1 SYNOPSIS
use Wurm qw(mob let);
use Wurm::Grub::REST;
use Data::UUID;
use JSON::XS;
use Tenjin;
my $grub = Wurm::Grub::REST->new
->get(
sub {
my $meal = shift;
json}
? to_json($meal)
: to_html($meal, 'item.html')
;
},
sub {
my $meal = shift;
$meal->grit->{items} = $meal->mind->{meld};
return $meal->vent->{json
);
use Data::Dumper;
use Convert::Base64;
use HTTP::Request::Common;
use LWP::UserAgent;
use JSON;
require Exporter;
$NB_API_VERSION = '3.1';
our $VERSION = '0.07';
our @ISA = qw(Ex
t($req);
if($result->is_success && $result->{_content} ne '') {
my $response=decode_json($result->{_content});
if(defined($response->{error}) || (defined($response->{success}) &
t($req);
if($result->is_success && $result->{_content} ne '') {
my $response=decode_json($result->{_content});
if(defined($response->{error}) || (defined($response->{success}) &
VERSION = '0.002'; # VERSION:
#pod =pod
#pod
#pod =encoding utf8
#pod
#pod =for stopwords IronMQ JSON config
#pod
#pod =cut
# Dependencies
use Moose;
use IO::Iron::IronMQ::Client 0.12;
use IO::Iron
#pod =attr config
#pod
#pod IronMQ uses a JSON config file to hold the project_id and token,
#pod and other config items if necessary. By default F<iron.json>.
#pod These config items can also be wri
pplied.
#pod
#pod =cut
has config => (
is => 'ro',
isa => 'Str',
default => 'iron.json',
);
#pod =attr queue
#pod
#pod Name of the queue. Must be supplied.
#pod
#pod =cut
has queue =
se utf8;
package Amon2::Auth::Site::Github;
use Mouse;
use Amon2::Auth;
use LWP::UserAgent;
use JSON;
use Amon2::Auth::Util qw(parse_content);
our $VERSION = '0.07';
sub moniker { 'github' }
has c
$res->is_success or return $callback->{on_error}->($res->status_line);
my $dat = decode_json($res->decoded_content);
push @args, $dat;
}
return $callback->{on_finished}->( @args
HTTP::Request::Params;
use URI::Escape;
use Data::Dumper;
use CGI::Cookie;
use MIME::Base64;
use JSON;
use Digest::SHA qw(sha256_base64);
use Crypt::OpenSSL::Random;
use Data::Validate::Struct;
use D
elf->{authbasic});
$res->code(HTTP_UNAUTHORIZED);
$res->header('Content-type' => 'application/json; charset=UTF-8');
$res->add_content("{ \"error\": \"please authenticate\" }");
return 0;
}
s
my $data;
if ($req->content) {
if ($req->content =~ /^\{/) {
eval { $data = decode_json($req->content); };
}
else {
# try decoding as query
my $query = HTTP::Request
ings;
use utf8;
package Amon2::Auth::Site::Facebook;
use Mouse;
use LWP::UserAgent;
use URI;
use JSON;
use Amon2::Auth;
sub moniker { 'facebook' }
for (qw(client_id scope client_secret)) {
has $_
ecoded_content;
return $callback->{on_error}->($res->decoded_content);
};
my $dat = decode_json($res->decoded_content);
if (my $err = $dat->{error}) {
return $callback->{on_error}->($err);
$res->is_success or return $callback->{on_error}->($res->status_line);
my $dat = decode_json($res->decoded_content);
push @args, $dat;
}
return $callback->{on_finished}->(@args)