onstants);
use HTTP::Request ();
use HTTP::Response ();
use LWP::MediaTypes ();
use Fcntl ();
use JSON::XS ();
use Lim ();
use Lim::Util ();
use Lim::RPC::Callback ();
use base qw(Lim::RPC::Protocol
1 NAME
...
=head1 VERSION
See L<Lim> for version.
=cut
our $VERSION = $Lim::VERSION;
our $JSON = JSON::XS->new->utf8->convert_blessed;
=head1 SYNOPSIS
...
=head1 SUBROUTINES/METHODS
=head2 In
$cb->cb->($response);
return 1;
}
if (defined $query->{jsonpCallback}) {
my ($content, $buf);
while (sysread(FILE, $buf, 64*1024)) {
use JSON;
use Net::HTTP::Spore;
use Net::HTTP::Spore::Middleware::DefaultParams;
use Net::HTTP::Spore::Middleware::Format::Text;
my $spec = {
name => 'BrowserMob Proxy',
formats => ['json'],
[
'port'
],
description => 'Create a new proxy. Returns a JSON object {"port": your_port} on success"'
},
delete_proxy => {
method =
equired_params => [
'port'
],
description => 'returns the JSON/HAR content representing all the HTTP traffic passed through the proxy'
},
auth_b
VERSION
version 0.01
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('Format::Text');
=head1 DESCRIPTION
Net::HTTP::Spore::Middleware::Format
$_[0];
}
=item $hash_ref = $error->TO_JSON
Returns a hash reference describing the error, this is to support passing
objects to L<JSON::XS>.
=cut
sub TO_JSON {
{
'Lim::Error' => {
use common::sense;
use Carp;
use Scalar::Util qw(weaken);
use Log::Log4perl ();
use DBI ();
use JSON::XS ();
use AnyEvent ();
use AnyEvent::Util ();
use Lim ();
=encoding utf8
=head1 NAME
Lim::
%args = ( @_ );
my $self = {
logger => Log::Log4perl->get_logger($class),
json => JSON::XS->new->utf8->convert_blessed,
busy => 0
};
bless $self, $class;
weaken
$response = $self->{json}->incr_parse($buf);
};
if ($@) {
Lim::DEBUG and $self->{logger}->debug('Response JSON parse failed: ', $@);
strict;
use warnings;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(Firewall);
use JSON -convert_blessed_universally;
#-----------------------------------------------------------------
====
#
=item B<as_json>
# Returns : pretty-printed JSON string representing Firewall object.
=cut ===================================================================
sub as_json {
my $self =
shift;
my $json = new JSON->canonical->allow_blessed->convert_blessed;
return $json->pretty->encode($self);
}
# Method ===============================================================
#
# Pa
essed weaken);
use HTTP::Status qw(:constants);
use HTTP::Request ();
use HTTP::Response ();
use JSON::XS ();
use Lim ();
use Lim::Util ();
use Lim::RPC::Callback ();
use base qw(Lim::RPC::Protocol
1 NAME
...
=head1 VERSION
See L<Lim> for version.
=cut
our $VERSION = $Lim::VERSION;
our $JSON = JSON::XS->new->utf8->convert_blessed;
our %REST_CRUD = (
GET => 'READ',
PUT => 'UPDATE',
ad1 SUBROUTINES/METHODS
=head2 Init
=cut
sub Init {
if (Lim::Config->{rpc}->{json}->{pretty}) {
$JSON->pretty(1);
}
}
=head2 Destroy
=cut
sub Destroy {
}
=head2 name
=cut
sub
rl client to control the Browsermob Proxy server
use strict;
use warnings;
use Moo;
use Carp;
use JSON;
use LWP::UserAgent;
use IO::Socket::INET;
use Browsermob::Proxy;
has path => (
is => 'rw',
_addr . ':' . $self->server_port . '/proxy');
if ($res->is_success) {
my $list = from_json($res->decoded_content)->{proxyList};
my @proxies = map {
$_->{port};
e_from(
POST => '/',
'Content-Type:' => 'text/json',
'Content:' => '{ "json": "here" }',
);
=item a L<Catalyst::Action> instance + option
ense;
use Carp;
use YAML::Any ();
=encoding utf8
=head1 NAME
Lim - Framework for RESTful JSON/XML, JSON-RPC, XML-RPC and SOAP
=head1 VERSION
Version 0.20
=cut
our $VERSION = '0.20';
our $CONFI
verify_require_client_cert => 1,
ca_path => '/etc/lim/ssl/certs'
},
json => {
pretty => 0
}
},
agent => {
config_file => '',
u
over multiple protocols.
It uses AnyEvent for async operations and SOAP::Lite, XMLRPC::Lite and JSON::XS
for processing protocol messages.
There are 3 parts in Lim that can work independenly, a Ser
gexp::Common; # balanced paren matching
use HTTP::Status qw(:constants :is status_message);
use JSON -convert_blessed_universally;
=head1 METHODS
=cut
# Constructor ==============================
s = $1) =~ s/flow-node-inventory:flow-feature-capability-//g);
$feature_info_ref = decode_json($features);
$status->code($BSC_OK);
}
else {
$status->http_err($resp);
my $node_connector_json = ($resp->content =~ /$RE{balanced}{-keep}{-begin => "\"node-connector\":\["}{-end => "]"}/ && $1);
@port_list = ($node_connector_json =~ /\"flow-node-inventory
package Captcha::reCAPTCHA::V2;
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use JSON;
# ABSTRACT: A Perl implementation of reCAPTCHA API version 2
our $VERSION = '0.3'; # VERSION
sub new
ptcha_script {
my ($self, $sitekey, $options) = @_;
my $json_options = to_json({ sitekey => $sitekey, %$options }, $self->{json_options} || {});
return '<script type="text/javascript">va
r onloadCallback = function(){grecaptcha.render(\''
. _element_id($sitekey) . '\',' . $json_options . ');};</script>';
}
sub html {
my ($self, $sitekey, $options) = @_;
$options ||=
er controlled
by a Brocade::BSC controller.
=cut
use strict;
use warnings;
use Data::Walk;
use JSON -convert_blessed_universally;
package Brocade::BSC::Node::NC::Vrouter::VPN;
use parent qw(Clone
m B<as_json>
# Returns : VPN as formatted JSON string.
=cut ===================================================================
sub as_json {
my $self = shift;
my $json = new JSON->canon
ical->allow_blessed->convert_blessed;
return $json->pretty->encode($self);
}
# Subroutine ===========================================================
# _strip_undef: remove all keys
If you use that on structured data (like a JSON structure), this might render your
data invalid. For instance if you have a large base64 string in your JSON, it will be broken
by this. To avoid this
Crawl communities. CSV is too
ill-defined. XML is too heavyweight. I'd say the same for YAML and JSON.
=head1 FUNCTIONS
=head2 read_xlogfile FILENAME => ARRAY OF HASHREFS
Takes a file and parses i
n - Queue like low-level interface for Gearman.
=head1 SYNOPSIS
use Queue::Gearman;
use JSON;
sub add {
my $args = shift;
return $args->{left} + $args->{rigth};
}
=> ['127.0.0.1:6667'],
serialize_method => \&JSON::encode_json,
deserialize_method => \&JSON::decode_json,
);
$queue->can_do('add');
my $task = $queue->enqueu
tworking controller.
=cut
package Brocade::BSC::Node;
use strict;
use warnings;
use YAML;
use JSON -convert_blessed_universally;
=head1 METHODS
=cut
# Constructor ==============================
===========
#
=item B<as_json>
# Returns : Returns pretty-printed JSON string representing netconf node.
=cut
sub as_json {
my $self = shift;
my $json = new JSON->canonical->allow_blesse
d->convert_blessed;
return $json->pretty->encode($self);
}
# Method ===============================================================
#
=item B<ctrl_req>
# Parameters: $method (string, req) HTT
PANTS.txt
Makefile
Makefile.old
MANIFEST.bak
META.json
META.yml
pm_to_blib
README
>,
],
);
$builder.cre
tatus qw(:constants);
use YAML;
use LWP;
use HTTP::Status qw(:constants :is status_message);
use JSON -convert_blessed_universally;
use XML::Parser;
use Carp::Assert;
=head1 METHODS
=cut
# Constru
s_json>
# Returns pretty-printed JSON string representing BSC object.
=cut
sub as_json {
my $self = shift;
my $json = new JSON->canonical->allow_blessed->convert_blessed;
return $json-
p->code == HTTP_OK) {
if ($resp->content =~ /\"nodes\"/) {
my $nodes = decode_json($resp->content)->{nodes}->{node};
if (! $nodes) {
$status->code($BSC_
ation;
use File::Basename;
use File::Path;
use File::Slurp;
use HTML::Entities;
use IO::File;
use JSON;
use Time::Local;
use Metabase 0.004;
use Metabase::Fact;
use Metabase::Resource;
use CPAN::T
a::FlexSerializer->new(
detect_compression => 1,
detect_json => 1,
output_format => 'json'
);
$self->{serializer2} = Data::FlexSerializer->new(
d
me = ref $fact;
$facts{$name} = $fact->as_struct;
$facts{$name}{content} = decode_json($facts{$name}{content});
}
return \%facts;
}
sub parse_report {
my ($self,%hash) =