e App::DeDuppy;
# ABSTRACT: generate json files from casperjs test arguments
use strict;
use warnings;
use 5.010;
use Carp;
use Moo;
use MooX::Options;
use JSON;
option 'arglist' => (is => 'ro',
default => sub { [] });
sub truthify_maybe {
$_[0] eq 'false' ? JSON::false :
$_[0] eq 'true' ? JSON::true : $_[0];
}
sub arrayrefify_maybe {
my @values = split(/,/, $_[0]
$+{value});
$self->options->{$option} = defined $value ? arrayrefify_maybe($value) : JSON::true;
} else {
if ($self->subcommand_is_set) {
push @{$se
to pass test configurations as json files
use strict;
use warnings;
use Moo;
use MooX::Options;
use IPC::Run qw/run new_chunker/;
use File::Which;
use IO::All;
use JSON;
use DDP;
use Carp;
use Try::T
=> 'rw',
required => 1,
format => 's@',
doc =>
'Test option: one ore more json file(s) containing the casperjs tests to perform'
);
option 'casper_path' => (
is =>
my $content = io($file)->slurp;
try {
$ret->{$file} = decode_json($content);
}
catch {
carp "'$file' is not valid: $_";
Plack::Request;
use Protocol::WebSocket::Handshake::Server;
use Protocol::WebSocket::Frame;
use JSON;
use HTML::Selector::XPath ();
use File::Basename qw(dirname);
use File::Spec::Functions qw(cat
buf);
while (my $message = $frame->next) {
my $data = JSON->new->decode($message);
$self->debug('message in:', $data);
(my ($action) = $req->path_info =~ m<^/(confirm|prompt)$>) {
my $args = eval { decode_json($req->parameters->{args}) } || [];
my $response = ( $self->{"on_$action"} || sub { re
type);
}
sub is_binary {
my $mime_type = shift;
$mime_type !~ /\b(?:text|xml|javascript|json)\b/;
}
sub get_stuff {
my ($self, $path, $query) = @_;
my $key = $path . $query;
if
ct;
use warnings;
use Any::URI::Escape qw(uri_escape);
use JSON;
use Search::Elasticsearch::Util qw(throw parse_params);
use Carp;
has 'JSON' => ( is => 'lazy' );
has '_base_qs' => ( is => 'ro',
', @$vals );
},
);
#===================================
sub _build_JSON {
#===================================
JSON->new->utf8(1);
}
#===================================
sub _build_builder
s}
? $params->{post_process}->($result)
: $result;
return $params->{as_json} ? $self->JSON->encode($result) : $result;
}
#===================================
sub use_index {
#===
scroll} ||= '1m';
my $method = $params->{q} ? 'searchqs' : 'search';
my $as_json = delete $params->{as_json};
my $results = $es->$method($params);
my $self = {
_es =
max_score},
_facets => $results->{facets},
_eof => 0,
_as_json => $as_json,
};
return bless( $self, $class );
}
#===================================
sub ne
my @results = splice @{ $self->{_buffer} }, 0, $size;
return
$self->{_as_json} ? $self->{_es}->JSON->encode( \@results )
: $size == 1 ? $results[0]
:
OneTool Configuration module
=cut
use strict;
use warnings;
use FindBin;
use File::Slurp;
use JSON;
my $DIR_CONFIG = "$FindBin::Bin/../conf";
=head1 FUNCTIONS
=head2 Directory($directory)
Sets
)
);
if ((defined $file) && (-r $file))
{
my $json_str = read_file($file);
my $conf = from_json($json_str);
return ($conf);
}
return (undef);
}
1;
nce::CampBX;
$Finance::CampBX::VERSION = '0.2';
use strict;
use warnings;
use LWP::UserAgent;
use JSON -support_by_pp;
sub ticker(){
return sendrequest("http://campbx.com/api/xticker.php");
}
sub
$url );
}
if ($response->is_success) {
my $content = $response->content;
my $json = new JSON;
return $json->utf8->decode($content);
} else {
return 0;
}
}
sub new {
my $package =
weight::VERSION = '1.03';
use 5.006;
use JSON 2.00 (); # works with JSON::XS
use Moose::Role;
use namespace::autoclean;
use Scalar::Util ();
my $JSON = JSON->new->utf8->canonical;
our %INSTANCES;
| ref( $args[0] ) ne 'HASH' )
? $class->BUILDARGS(@args)
: $args[0];
return $JSON->encode($args);
}
1;
__END__
=pod
=head1 NAME
MooseX::Role::Flyweight - Automatically memoiz
lient = Net::HTTP::Spore->new_from_spec('api.json');
$client->enable(
header_name => 'Content-Type',
header_value => 'application/json'
);
=head1 DESCRIPTION
This module is
use File::Spec;
use File::Copy;
use Term::ReadLine;
use Term::ReadLine::Perl;
use WWW::REST;
use JSON::XS;
use 5.010;
use utf8;
option 'from' => (
doc => 'Source directory to organize',
is
ift;
croak $self->status_line if $self->is_error;
my $ct = decode_json( $self->content );
return ref $ct eq 'ARRAY' ? $ct->[0] : $ct;
}
rp);
use attributes qw();
use URI::Escape;
our $VERSION = '0.4';
sub __jsonp_method {
my ($self,$req,$resultset,$rs,$jsonp_method_name,@args) = @_;
my ($primary) = $rs->result_source->prima
ride;
my $jsonp_method_coderef = exists $overrides->{$resultset}{$jsonp_method_name} || $object->can($jsonp_method_name);
if ( !$object->can($jsonp_method_name)
# if jsonp method is d
the overrides, we don't care if it has the 'JSONP' subroutine attribute
|| __method_is_jsonp($jsonp_method_coderef) ) {
# method has a 'JSONP' attribute, and was declared in the result
PI::Test;
use strict;
use warnings;
use base 'Exporter';
use Test::More;
use Path::Extended;
use JSON::XS;
use Groonga::API;
use Groonga::API::Constants qw/:all/;
use version;
no bytes;
our @EXPORT
n_test
indexed_table_test
load_into_table
version_ge
/,
@Test::More::EXPORT,
@JSON::XS::EXPORT,
@Groonga::API::Constants::EXPORT_OK,
);
our %TMPDIR;
our $ROOT;
sub version_ge {
table";
my $json = encode_json($data);
my $rc = Groonga::API::load($ctx, GRN_CONTENT_JSON,
$table_name, bytes::length($table_name),
undef, 0,
$json, bytes::length($json),
undef, 0
gs FATAL => 'all';
use Date::Calc qw(Add_Delta_YMDHMS Today_and_Now);
use HTTP::Tiny;
use JSON qw(decode_json);
use URI::Escape qw(uri_escape);
=head1 NAME
WWW::SEOGears - Perl Interface for SEOGea
rns undef on failure (sets $self->{error} with the proper error). Returns a hash with the decoded json data from the API server if successful.
=cut
sub _make_request_handler {
my $self = shift;
ror, 1);
}
my $json = eval{ decode_json($output); };
if ($EVAL_ERROR){
$self->_error('Failed to decode JSON - Invalid data returned from server: '.$output, 1);
}
return $json;
}
=head2 _make
as occurred"
#define QERR_JSON_PARSE_ERROR \
ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s"
#define QERR_JSON_PARSING \
ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
#define QERR_KVM_
/*
* JSON streaming support
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or late
#ifndef QEMU_JSON_STREAMER_H
#define QEMU_JSON_STREAMER_H
#include "qapi/qmp/qlist.h"
#include "qapi/qmp/json-lexer.h"
typedef struct JSONMessageParser
{
void (*emit)(struct JSONMessageParser
QList *tokens);
JSONLexer lexer;
int brace_count;
int bracket_count;
QList *tokens;
uint64_t token_size;
} JSONMessageParser;
void json_message_parser_init(JSONMessageParser *pars
use strict;
use warnings;
package Chat::iFly;
use HTTP::Thin;
use HTTP::Request::Common;
use JSON;
use URI;
use Ouch;
use Moo;
my $convert_to_string = sub { "$_[0]" };
=head1 NAME
Chat::iFly - An
"text/javascript">Drupal={};Drupal.settings={};Drupal.settings.drupalchat={};Drupal.settings='.to_json($self->init($user)).';</script>';
$out .= '<script type="text/javascript" src="' . $self->sta
$self, $user) = @_;
ouch(441, 'user is required', 'user') unless defined $user;
return to_json({(%{$user}, %{$self->get_key($user)})});
}
=head2 init( user )
This method is called by C<rende
/*
* JSON lexer
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
* See th
U_JSON_LEXER_H
#define QEMU_JSON_LEXER_H
#include "qapi/qmp/qstring.h"
#include "qapi/qmp/qlist.h"
typedef enum json_token_type {
JSON_OPERATOR = 100,
JSON_INTEGER,
JSON_FLOAT,
JSON_
EYWORD,
JSON_STRING,
JSON_ESCAPE,
JSON_SKIP,
JSON_ERROR,
} JSONTokenType;
typedef struct JSONLexer JSONLexer;
typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, i
ation in consumers
of this library, but may be useful for other purposes. All classes are set
to JSON format and File IO.
=head1 AUTHOR
Cory Watson, C<< <gphat@cpan.org> >>
=head1 ACKNOWLEDGEMENTS
=back
=head2 Recommended XS module for better performance
=over 4
=item JSON::XS is recommended
If you are using JSON.
=item HTTP::Parser::XS is recommended
If you are using Plack.
=item Li
head2 Recommended version to enable good feature
=over 4
=item Amon2 E<lt> 3.29 does not have
JSON hijacking detection.
=item Log::Minimal E<lt> 0.10 does not have
LM_COLOR
=item Log::Minimal