e Data::Dumper;
use Fcntl qw( :DEFAULT :seek );
use File::Find;
use File::Spec::Functions ();
use JSON;
use Try::Tiny;
use strict;
use warnings;
use base qw(Exporter);
our @EXPORT_OK =
qw(can_load
file checksum combine_similar_paths dump_one_line find_wanted first_index is_absolute json_encode json_decode mason_canon_path read_file taint_is_on touch_file trim uniq write_file);
my $Fetch_Flags
::ISA[0] eq 'File::Spec::Unix';
# Map null, true and false to real Perl values
if ( JSON->VERSION < 2 ) {
$JSON::UnMapping = 1;
}
sub can_load {
# Load $class_name if possible. Return 1 if
package Reddit;
use 5.010001;
use strict;
use warnings;
use JSON;
use HTTP::Cookies;
use LWP::UserAgent;
use Moose;
=head1 NAME
Reddit - Perl extension for http://www.reddit.com
See github for t
t.
This module is still largely inprogress.
=head2 Requires
common::sense
LWP::UserAgent
JSON
HTTP::Cookies
For Testing:
Data::Dumper
=head2 EXPORT
None.
=cut
# for testing purpose
ub { $_[0]->api_url . 'vote' },
);
has 'api_type' => (
is => 'ro',
isa => 'Str',
default => 'json',
);
has 'ua' => (
is => 'rw',
isa => 'LWP::UserAgent',
default => sub { LWP::UserA
ason::Util
qw(can_load catdir catfile combine_similar_paths find_wanted first_index is_absolute json_decode mason_canon_path read_file taint_is_on touch_file uniq write_file);
use Memoize;
use Moose
my $line = <$fh>;
if ( my ($flags_str) = ( $line =~ /\# FLAGS: (.*)/ ) ) {
$flags = json_decode($flags_str);
}
return $flags;
}
method _flush_load_cache () {
Memoize::flush_
ins with a -, or whose key consists entirely of
nonword characters (thereby covering '=', '>', pg json ops, etc.) is
processed as an operator hashpair.
=head3 operator hashpair w/node type
If a node
roformats;
use 5.010;
use autodie;
use strict;
use utf8;
use HTML::Microformats 0.100 qw();
use JSON 2.00 qw();
use RDF::Trine 0.135 qw();
use RDF::Query 2.900 qw();
use XML::Atom::OWL 0.100 qw();
t, $entry);
}
return $rv;
}
*entry_all_objects = \&all_objects;
sub TO_JSON
{
return $_[0]->all_objects;
}
sub json
{
my ($self, %opts) = @_;
$opts{'convert_blessed'} = 1
unless defined
ssed'};
$opts{'utf8'} = 1
unless defined $opts{'utf8'};
return JSON::to_json($self->all_objects, \%opts);
}
sub entry_json
{
my ($self, $entry, %opts) = @_;
$opts{'convert_blessed'} = 1
package Collectd::Plugin::Write::Message::Passing;
use strict;
use warnings;
use Collectd ();
use JSON;
use Module::Runtime qw/ require_module /;
use String::RewritePrefix ();
use Try::Tiny;
use names
$@");
return 0;
}
$CONFIG{encoderclass} ||= '+Message::Passing::Filter::Encoder::JSON';
$CONFIG{encoderclass} = String::RewritePrefix->rewrite(
{ '' => 'Message::Passing::
2.168.0.1:5552"
</outputoptions>
# OPTIONAL - Defaults to JSON
#encoderclass "JSON"
#<encoderoptions>
# pretty "0"
#</encodero
se File::ShareDir;
use constant DB_FILE => File::ShareDir::dist_file('App-PortDistances', 'db.json');
use App::PortDistances::DB::Port;
use App::PortDistances::Types
qw/
my($self, $serialize) = @_;
my %serializers = (
json => [
sub { require JSON },
\&JSON::to_json,
\&JSON::from_json
],
storable => [
sub { require Storable },
r2;
use strict;
use warnings;
use WWW::Curl::Easy;
use Digest::MD5 qw( md5_hex );
use JSON::XS qw( decode_json );
use URI::Escape qw( uri_escape );
BEGIN {
use Exporter ();
use vars qw($VER
est {
my ($self, $params, $method) = @_;
my $response;
my $fields = join("&", "format=json", map { join("=", $_, uri_escape($params->{$_})) } keys %$params);
if ( $method and $method
{ method => "auth.getToken", api_key => $self->{"api_key"} });
$self->{"api_token"} = decode_json($response)->{"token"} || 0;
return $self->{"api_token"};
}
sub auth_getSession {
my ($s
$VERSION = 'v3.9.4';
use Getopt::Long;
use Pod::Usage;
use MIME::Base64;
use LWP::UserAgent;
use JSON;
## no critic (Capitalization, RequireCarping)
# command line variables binds
my @pem;
next;
}
push @cert, $line;
}
close $fh or die "close: $!";
}
my $json_data = to_json( {'chain' => \@chain } );
while (my ($log_name, $log_url) = each %logs) {
write_log(
q = HTTP::Request->new('POST', $log_url . '/ct/v1/add-chain', ['Content-Type' => 'application/json'], $json_data);
my $res = $ua->request($req);
if (!$res->is_success) {
write_log('Fa
{
$Juno::Check::RawCommand::VERSION = '0.005';
}
# ABSTRACT: A raw command check for Juno
use JSON;
use Carp;
use Try::Tiny;
use AnyEvent::Util 'fork_call';
use System::Command;
use Any::Moose;
u
return encode_json $data;
} sub {
# deserialize
my $serialized = shift;
my $data = '';
try { $data = decode_json $serialized }
enum 'AcceptType' => qw(application/json application/xml);
has accept_type => (
is => 'rw',
isa => 'AcceptType',
default => 'application/json',
);
has api_version => ( is => 'r
default => App::PortDistances::DB::DB_FILE,
documentation => 'source database in JSON format',
);
has 'cache' => (
is => 'ro',
isa => 'St
il::TypeConstraints qw(enum);
use Try::Tiny;
use Data::Stream::Bulk::DBI;
use SQL::Abstract;
use JSON;
use Scalar::Util qw(weaken refaddr);
use List::MoreUtils qw(any);
use KiokuDB::Backend::DBI::Sc
}
}
has '+serializer' => ( default => "json" ); # to make dumps readable
has json => (
isa => "Object",
is => "ro",
default => sub { JSON->new },
);
has create => (
isa => "Boo
$i_sth->finish;
});
}
sub _parse_dbic_key {
my ( $self, $key ) = @_;
@{ $self->json->decode(substr($key,length('dbic:row:'))) };
}
sub _part_rows_and_ids {
my ( $self, $rows_an
: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;
}
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'
allow quick and easy
serialization. So a quick call to C<freeze> will serialize this object into
JSON and C<thaw> will inflate it. The only caveat is that we don't serialize
the C<value> attribute.
to refill forms or something.
my $json = $results->freeze({ format => 'JSON' });
# ...
my $results = Data::Verifier::Results->thaw($json, { format => 'JSON' });
=head1 INTERNALS
This module
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
history of the changes to
the text. This is in the form of an array of hashes, serialized
using JSON.
The array is in the order in which the individual changes took
place. Each row has fields:
nfig no_ignore_case bundling );
use FindBin qw( $Bin );
use Emacs::Rep qw( :all );
use JSON; # encode_json
our $VERSION = 1.00;
my $prog = basename($0);
my $DEBUG = 0; # TO
se( $fout );
}
# serialize the data to pass to emacs
my $chg_md_json = encode_json( $change_metadata_aref );
print $chg_md_json;
}
### end main, into the subs
sub say_usage {
my $usage=<<"USE
package Echo::StreamServer::MuxRequest;
use 5.008008;
use strict;
use warnings;
use JSON;
our $VERSION = '0.01';
our @MUX_METHODS = ( 'search', 'count' );
our $MUX_MAX_REQUESTS = 100; # server-sid
calls TO_JSON() method on the blessed hash.
# This method returns a "plain" hash to render the document.
#
# NOTE: The convert_blessed flag must be set (false by default).
# my $json = JSON->new->con
# ======================================================================
my $json = JSON->new->convert_blessed;
sub TO_JSON {
my $self = shift;
my %hash = %$self;
return \%hash;
}
sub new {
my