package App::BCSSH::Handler;
use Moo::Role;
use JSON qw(encode_json decode_json);
use App::BCSSH::Message;
use MooX::CaptainHook qw(on_application);
my %handlers;
sub handlers {
return %handlers;
{
my ($self, $args, $send, $socket) = @_;
my $json_send = sub {
my @response = @_;
my $rmessage = @response ? encode_json(\@response) : '';
$send->(BCSSH_SUCCESS, $rme
ssage);
return $socket;
};
my $handler_args = decode_json($args);
$self->handle($json_send, @$handler_args);
return;
}
sub handler {
my $self = shift;
return sub {
am|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|a
update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouse
cified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,
RSION = '0.007';
}
use diagnostics;
use Moose;
use WWW::WuFoo::Field;
use WWW::WuFoo::Entry;
use JSON;
use Data::Dumper;
# ABSTRACT: The Forms API is used to gather details about the forms you have
($pagestart == 0 || $entries > 0) {
my $url = '/api/v3/forms/' . $self->hash . '/entries.json?pageSize=100&pageStart=' . $pagestart;
my $ref = $self->_wufoo->do_request($url)->{Entrie
{
my ($self) = @_;
my @arr;
my $url = '/api/v3/forms/' . $self->hash . '/fields.json';
my $ref = $self->_wufoo->do_request($url)->{Fields};
# my $orderby = 0;
foreach my
. $path
)
);
# Headers
$self->tx->req->headers->header(Accept => 'application/json');
return $self->tx;
}
1;
=head1 NAME
Net::Heroku::UserAgent
=head1 DESCRIPTION
Subclass
$WWW::WuFoo::VERSION = '0.007';
}
use strict;
use warnings;
use Moose;
use LWP::UserAgent;
use JSON;
use WWW::WuFoo::Form;
use WWW::WuFoo::User;
use Data::Dumper;
# ABSTRACT: Interface to WuFoo.c
ash eq $opts{hash};
}
}
sub forms {
my ($self, $opts) = @_;
my $url = '/api/v3/forms.json?IncludeTodayCount=true';
my @arr;
my $obj = $self->do_request($url)->{Forms};
forea
return \@arr;
}
sub users {
my ($self) = @_;
my @arr;
my $url = '/api/v3/users.json';
my $users = $self->do_request($url)->{Users};
foreach my $user (@$users) {
my $
package Graph::D3;
use strict;
use 5.008_005;
our $VERSION = '0.03';
use Moo;
use JSON;
use Graph;
has graph => (
is => 'ro',
required => 1
);
has type => (
is => 'ro',
default =>
}
my $output = { nodes => \@nodes, links => \@links };
return $self->type eq 'json' ? encode_json $output : $output;
}
# http://mbostock.github.io/d3/talk/20111116/bundle.html
sub hierar
mports };
}
return $self->type eq 'json' ? encode_json \@bundle : \@bundle;
}
1;
__END__
=encoding utf-8
=head1 NAME
Graph::D3 - Create ref/json to show node-edge graph with D3.js
=head
'map' => {
'text/x-yaml' => 'YAML',
'application/json' => 'JSON',
'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Dumper' ],
},
)
package Net::Heroku;
use Mojo::Base -base;
use Net::Heroku::UserAgent;
use Mojo::JSON;
use Mojo::Util 'url_escape';
our $VERSION = 0.10;
has host => 'api.heroku.com';
has ua => sub { Net::Heroku::Us
n if $res->code =~ /^2\d{2}$/;
return (
code => $res->code,
message => ($res->json ? $res->json->{error} : $res->body)
);
}
sub _retrieve_api_key {
my ($self, $email, $password) = @
l => $email, password => $password})
->res->json('/api_key');
}
sub apps {
my ($self, $name) = @_;
return @{$self->ua->get('/apps')->res->json || []};
}
sub app_created {
my ($self, %para
subdomain' => (is => 'rw', isa => 'Str');
has 'xml' => (is => 'rw', isa => 'Str');
has 'json' => (is => 'rw', isa => 'Str');
has 'formid' => (is => 'rw', isa => 'Str');
has 'pret
collections
=cut
package Collection::CrcColl;
use strict;
use warnings;
use String::CRC32;
use JSON::XS;
use Collection::AutoSQL;
our @ISA = qw(Collection::AutoSQL);
our $VERSION = '0.11';
sub raw
( raw2hex) BINARY
refhash => { var1=>'1', var2=>0} string ('var1=0 , var=2')
json => string json serialized
=cut
sub _create {
my ( $self, %arg ) = @_;
my $table_name = $self-
d=0'
$val ={ map { split/=/,$_ } split /,/, $val };
}
if ($type eq 'json' ) {
unless ($val) {
$val = {}
} else {
#
use JSON;
use List::MoreUtils ();
use Moose::Util ();
BEGIN { extends 'Catalyst::Controller'; }
__PACKAGE__->config(
default => 'application/json',
map => { 'application/json' =>
/twitter/tweet/$id
Will return the document C<$id>. If L</raw_get> is set to false, the returned
JSON will not include the ElasticSearch metadata. Instead the C<_source> or
C<fields> property is retu
This helper action can be used to return a error message to the client.
The client will receive a JSON response that includes the message and
the error code. If the message is a L<ElasticSearch::Error
N = '0.000000_03';
}
# ABSTRACT: A list of a repository's hooks
use common::sense;
use autobox::JSON;
use parent 'GitHub::API::Base';
# debugging...
#use Smart::Comments '###';
#sub test { ... }
N = '0.000000_03';
}
# ABSTRACT: A list of a repository's hooks
use common::sense;
use autobox::JSON;
use parent 'GitHub::API::Base';
#use aliased 'GitHub::API::Hook';
# debugging...
#use Smart::
b::API::Base;
{
$GitHub::API::Base::VERSION = '0.000000_03';
}
use common::sense;
use autobox::JSON;
# ABSTRACT: Base class for GitHub::API classes
# debugging...
#use Smart::Comments '###';
sub
>{url},
{ headers => $self->{headers} },
)
->{content}
->from_json
;
return ref $items eq 'ARRAY' ? $items : [ $items ];
}
sub _post {
my ($self,
->{ua}
->post($url, { content => $content->to_json, headers => $self->{headers} })
;
return $resp->{content}->from_json;
}
sub _delete {
my ($self, $content, $path_part) =
ated using the C<new_with_config> method. A number
of file formats are supported (e.g. XML, YAML, JSON, Apache-style,
Windows INI), see the L<Config::Any> documentation for full
details. The default v
Hub::API;
use autobox::JSON;
say GitHub::API
->new
->user
->repo("moosex-attributeshortcuts")
->hooks
->all
->to_json
;
=head1 DESCRIP
nnection;
use MonitisMonitorManager::M3Logger;
use Carp;
use Date::Manip;
use File::Basename;
use JSON;
use Data::Dumper;
#################
### CONSTANTS ###
#################
require Exporter;
our
formatted_results = format_results(\%results);
my $formatted_additional_results = format_results_json(\%additional_results);
return $self->update_data_for_monitor(
agent_name => $agent_name,
mo
s;
}
# formats the hash of results into a string
sub format_results_json(%) {
my (%results) = %{$_[0]};
return "[" . encode_json(\%results) . "]";
}
# simply replaces the %SOMETHING% with the rele
package Net::Nakamap;
use 5.008_001;
use HTTP::Request::Common;
use JSON::XS;
use LWP::UserAgent;
use Mouse;
our $VERSION = '0.03';
has ua => (
is => 'rw',
lazy => 1,
default =>
,
);
my $res = $self->ua->post($uri);
if ($res->is_success) {
return decode_json($res->content);
}
else {
$self->last_error($res->content);
return undef;
s,
);
my $res = $self->ua->get($uri);
if ($res->is_success) {
return decode_json($res->content);
}
else {
$self->last_error($res->content);
return undef;
qw();
use Scalar::Util qw( blessed );
sub filename { return 'schema' }
sub suffix { return '.json' }
my $cache;
sub check {
my ( $self, $data ) = @_;
if ( not exists $cache->{ _CLASS($self
_CLASS($self) }->check($data);
}
sub decode_file {
my ( $self, $file ) = @_;
require JSON;
return JSON->new()->utf8(1)->relaxed(1)->decode( scalar $file->slurp() );
}
sub _make_rx {
my ($se
ta::Rx::Tools::ShareDirValidator';
sub filename { 'schema' } # default value.
sub suffix {'.json'} # default value.
1;
...
Later:
use Foo;
Foo->check({ some => [ 'data', 'structure'
}
sub load_config {
my $file = shift;
open(my $fh, "<", $file);
my $config = eval { JSON->new->relaxed->utf8->decode(join('',<$fh>)); };
close $fh;
return $config || { };
}
sub
};
};
} elsif ( $file =~ /\.json$/ ) {
eval {
open(my $fh, "<", $file);
my $config = JSON->new->relaxed->utf8->decode(join('',<$fh>));
=head1 INTERNAL FUNCTIONS
=head2 load_config ( $filename )
Load a configuration file (relaxed JSON format) and return a hash reference.
On error the hash reference is empty.
=head2 expand_from_co