'!' => sub { $_[0]->new(!${ $_[0] }) },
'""' => sub { ${ $_[0] } },
;
sub TO_JSON {
my ($self) = @_;
$$self ? 'true' : 'false';
}
sub TO_MSGPACK {
my ($self) = @_;
file;
use Path::Tiny;
use Try::Tiny;
use CPAN::Changes;
use CPAN::Changes::Group;
use JSON::MaybeXS qw/decode_json/;
with qw/
Dist::Zilla::Role::Plugin
Dist::Zilla::Role::FileMunger
/;
sub m
if(!path('META.json')->exists) {
$self->log(['Could not find META.json in distribution root - skips']);
return;
}
my $current_meta = decode_json(path('META.json')->slurp)->{'p
lf->repo->run('show', join ':' => ($tag, 'META.json'));
}
catch {
if($_ =~ m{^fatal:}) {
$self->log(['Could not find META.json in %s - skipping', $tag]);
}
t data_size, const char *format, va_list args);
/**
* \brief print to \a file msgpacked data in JSON format.
* MP_EXT is printed as "EXT" only
* \param file - pointer to file (or NULL for stdout)
n qw{ POST };
use UNIVERSAL::require;
use URI;
use Encode;
use Data::Dumper;
use URI::Escape;
use JSON;
use Armadito::Prelude::HTTP::Client::ArmaditoAV::Event;
use Armadito::Prelude::HTTP::Client::Ar
adito-prelude',
'Referer' => $url
);
$headers->header( 'Content-Type' => 'application/json' ) if ( $params{method} eq 'POST' );
$headers->header( 'X-Armadito-Token' => $self->{token} )
{
my ( $self, $response ) = @_;
$self->{logger}->info( $response->content() );
my $obj = from_json( $response->content(), { utf8 => 1 } );
if ( defined( $obj->{token} ) ) {
$self->{token} = $o
ed from IUP::Internal::Canvas
#XXX-CHECKLATER hack to make the following modules apper in META.json provide=>...
package IUP::Canvas::Bitmap;
package IUP::Canvas::Palette;
package IUP::Canvas::P
e Plack::Util::Accessor qw( dirs filter wait );
use AnyEvent;
use AnyEvent::Filesys::Notify;
use JSON::Any;
use File::Slurp;
use File::ShareDir qw(dist_file);
use File::Basename;
use Carp;
use Readon
ents as json
sub _respond {
my ( $self, $resp ) = @_;
## TODO: check that resp is a hash ref
return [
200,
[ 'Content-Type' => 'application/json' ],
[ JSON::Any->n
>new({
recorded_date => $dt,
events => $arr_events
});
=cut
use Moose;
use JSON;
extends 'Quant::Framework::Utils::MarketData';
use Date::Utility;
use List::MoreUtils qw(first
th to that file. For example, this command:
search_inc('JSON/Tiny.pm')
might return somethng like this:
/usr/local/share/perl/5.18.2/JSON/Tiny.pm
The given path must be the full path within the
not return the path to JSON/Tiny.pm:
search_inc('Tiny.pm')
That feature might be added later.
If you prefer, you can give the path in Perl module format:
search_inc('JSON::Tiny')
=cut
sub sea
_message_div',
content => $self -> param('renderer') -> render('note.tx', $param),
};
return JSON::XS -> new -> utf8 -> encode($output);
=head2 How does add_header() differ from header_add()?
F
th to that file. For example, this command:
search_inc('JSON/Tiny.pm')
might return somethng like this:
/usr/local/share/perl/5.18.2/JSON/Tiny.pm
The given path must be the full path within the
not return the path to JSON/Tiny.pm:
search_inc('Tiny.pm')
That feature might be added later.
If you prefer, you can give the path in Perl module format:
search_inc('JSON::Tiny')
=head2 script
arch instance
use Mojo::Base 'Mojolicious::Plugin';
use Time::HiRes qw/time/;
use Mojo::JSON qw/encode_json/;
sub register {
my ($self, $app, $conf) = @_;
my $index = $conf->{index} || die "n
}
}
};
my $url = "${es_url}/${index}/${type}/_mapping";
my $tx = $app->ua->post($url, json => $index_meta);
$app->hook(before_dispatch => sub {
my $c = shift;
$c->stash->{'mojol
};
}
my $url = "${es_url}/${index}/${type}/?timestamp=${t}";
$c->app->ua->post($url, json => $data, sub {
my ($ua, $tx) = @_;
if (! $tx) {
$c->app->log->warn("could no
Forbidden
NotFound
ClientError
ServerError
TextPlain
AsJSON
FromFile
FromCharString
FromByteString
FromHandle
Redirec
$c->detach;
}
=head2 AsJSON($c, $status?, $data)
Sets a JSON 200 OK response by default, with an optional custom status. Data
should be serializable by a view named C<JSON> provided by your applic
ation
(e.g. via L<Catalyst::View::JSON>).
=cut
sub AsJSON {
my ($c, $status, $data) = @_;
($status, $data) = (undef, $status)
if @_ == 2;
$status //= HTTP_OK;
$c->response->s
e Moose;
use MooseX::FollowPBP;
use LWP::UserAgent;
use Log::Log4perl qw( :easy );
use JSON::Parse qw( parse_json );
our $VERSION = 1.04;
=head1 ATTRIBUTES
=over 2
=cut
#=item B<api_base>
#Base
and more information about the results.
=over 2
=item B<get_run>
Accesses the API's C<getRun> JSON endpoint and returns analysis information for
a single run, passed in the arguments.
Arguments s
function takes an anonymous array of run accessions and sequentially
accesses the API's C<getRun> JSON endpoint to collect the analysis information
for each run in the list provided.
my $runInfo = $
with all the details. Besides, you can
also opt to have Twilio send its responses to you in CSV, JSON, or
HTML.
=head2 Using WWW::Twilio::API
Now that we have a basic understanding of how Twilio's
', 'json', or 'html' (any representation found at
http://www.twilio.com/docs/api/rest/tips) to the Twilio API call:
## return JSON in $response->{content}
$response = $twilio->POST('Calls.json',
## view a list of calls we've made
$response = $twilio->GET('Calls.json');
print $response->{content}; ## this is a JSON document
## view one particular call we've made
$response = $twili
#!/usr/bin/perl
use lib './lib';
use Furl::HTTP::OAuth;
use URI;
use Encode;
use JSON::XS;
my $client = Furl::HTTP::OAuth->new(
consumer_key => "vgyYVbu7yljXXd2MZTfDmw",
consumer_secret => "
earch?term=Food&location=San+Francisco');
use Data::Dumper;
warn Dumper({
version => $version,
code => $code,
message => $msg,
headers => $headers,
body => decode_json($body)
});
_;
return unless $self->{debug};
# require JSON::PP;
open my $fh, '>>:utf8', 'caroline.debug.log';
print $fh $stuff;
# print $fh JSON::PP->new->allow_nonref(1)->encode($stuff) . "\n";
#!/usr/bin/perl
use lib './lib';
use Furl::HTTP::OAuth;
use URI;
use Encode;
use JSON::XS;
my $client = Furl::HTTP::OAuth->new(
consumer_key => "vgyYVbu7yljXXd2MZTfDmw",
consumer_secret => "
=> $version,
code => $code,
message => $msg,
headers => $headers,
body => decode_json($body)
});
# consumer_key => "9djdj82h48djs9d2",
# consumer_secret => "consumersecret",
my ($self, $val) = @_;
state $json = do {
require JSON::MaybeXS;
JSON::MaybeXS->new->allow_nonref;
};
# we need cleaning since json can't handle qr//, for one.
stat
e $cleanser = do {
require Data::Clean::JSON;
Data::Clean::JSON->get_cleanser;
};
$json->encode($cleanser->clone_and_clean($val));
}
sub compile {
my ($self, %args) = @_;
{
require File::Temp;
require JSON::MaybeXS;
#require String::ShellQuote;
my $data = shift;
state $json = JSON::MaybeXS->new->allow_nonref;
# code t
s
my $src = "var validator = $v_src;\n\n".
"console.log(JSON.stringify(validator(".
$json->encode($data).")))";
my ($jsh, $jsfn) = File::Temp::tempfile();
file $jsfn: $!";
my $out = IPC::System::Options::readpipe($nodejs_path, $jsfn);
$json->decode($out);
};
}
1;
# ABSTRACT: Some functions to use JavaScript Sah validator code from
{name => 'value', type => 'TEXT', not_null => 1,},
{name => 'is_json', type => 'BOOLEAN', default => '0',},
],
foreign_keys => [[[qw(user_id)