eturn !!1 if is_plain_scalarref($value) && $$value == 1;
require JSON::PP;
return !!1 if JSON::PP::is_bool($value) && $value == JSON::PP::true();
return !!0;
}
sub is_false {
shift;
my ($value)
eturn !!1 if is_plain_scalarref($value) && $$value == 0;
require JSON::PP;
return !!1 if JSON::PP::is_bool($value) && $value == JSON::PP::false();
return !!0;
}
sub is_null {
return !defined $_[1
ict mode, override it and return false value.
SEE ALSO: L<The JSON SQL Injection Vulnerability|http://blog.kazuhooku.com/2014/07/the-json-sql-injection-vulnerability.html>
=head3 C<preload_all_row_c
"query=phone is $phone";
}
my $endpoint = $caller eq 'requesters' ? "itil/requesters.json" : "agents.json";
$endpoint .= $query unless $query eq "?";
$endpoint .= $query eq "?" ? "?state=$sta
er}{timezone} = $timezone if $timezone;
my $data = $self->_api->post_api("itil/requesters.json",$content);
return WebService::Freshservice::User->new( api => $self->_api, _raw => $data, id =
no if ($] >= 5.018), 'warnings' => 'experimental';
require bytes;
require utf8;
use FindBin;
use JSON;
use Pod::Simple::Text;
BEGIN
{
require Exporter;
our $VERSION = '1.22';
our @ISA
~ /^SCALAR\n(.*)/)
{
$result = $1;
} else
{
eval { $result = from_json($tmp, {utf8 => 1}) };
}
}
}
next;
}
}
unshift @cleanup, $tmp_path;
}
;
unless (ref($result))
{
$tmp = "SCALAR\n$result";
} else
{
eval { $tmp = to_json($result, {utf8 => 1, pretty => 1}) } if ref($result) eq "ARRAY" or ref($result) eq "HASH";
}
);
# Updateable Fields
method _build__raw {
return $self->api->get_api( "agents/".$self->id.".json" );
}
method _build_user {
# Grab our calling method by dropping 'WebService::Freshservice::Us
cal
=head2 active
boolean
=head2 restart_lsn
Last log serial number sent
=head2 full_data
A json object of the whole pg_replication_slots entry. You can use this to
get data not supported by b
through normal means.
=cut
my $query =
"
SELECT slot_name, slot_type, active, restart_lsn, to_jsonb(s) as full_data,
now() as querytime, CASE WHEN pg_is_in_recovery()
;
use Method::Signatures 20140224;
use List::MoreUtils qw(any);
use Carp qw( croak );
use JSON qw( encode_json );
use WebService::Freshservice::User::CustomField;
use Moo;
use MooX::HandlesVia;
use na
learer => 1 );
method _build__raw {
return $self->api->get_api( "itil/requesters/".$self->id.".json" );
}
method _build_user {
# Grab our calling method by dropping 'WebService::Freshservice::Us
rn;
}
method delete_requester {
return $self->api->delete_api( "itil/requesters/".$self->id.".json" );
}
method update_requester(:$attr?, :$value?) {
if ( $attr ) {
croak "'value' required
be nothing more than a light wrapper around Physics::Ballistics.
use strict;
use warnings;
use JSON;
use File::Slurp;
use IPC::Open3;
use lib "/home/ttk/modules";
use lib "./lib"; # For running fr
my $got_errors = 0;
while(defined(my $js = <STDIN>)) {
chomp($js);
my $hr = JSON::from_json($js);
$self->reset_the_blanks();
$self->{cartridge_name} = $hr->{cartridge_
in_achtung();
die(join("\n",($filenames_ar, @errs))) unless ($ok eq 'OK');
}
# print JSON::to_json({filenames_ar => $filenames_ar})."\n";
print join("\n",@{$filenames_ar})."\n" if (defined(
{
require File::Temp;
require JSON::MaybeXS;
#require String::ShellQuote;
my $data = shift;
state $json = JSON::MaybeXS->new->allow_nonref;
# code t
js
my $src = "var formatter = $code;\n\n".
"console.log(JSON.stringify(formatter(".
$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: Generate formatter code
__END__
=pod
=encoding UTF-8
Pipe)
=head2 (Client) (Socket)
=head2 (Client) (Server) Dealing with binary data
The choice as JSON as the network transport protocol (because it is the lowest
common denominator across languages l
this function via Riap in-process, there's nothing to worry about
since there is no round-trip to JSON. You can just:
my $res = Perinci::Access->new->request(call => "/MyLib/gzip",
=>{data=>"some data"}});
If you are using this function over HTTP or oher network protocol where JSON is
involved, you will need to encode the argument:
use MIME::Base64;
my $res = Perinci::Access
);
use File::Temp qw(tempfile tempdir);
use File::Which;
use IPC::System::Options qw(system);
use JSON::MaybeXS;
use List::Util qw(first);
use Moose;
with (
'Dist::Zilla::Role::FileFinderUser' =>
$self->write_modules_to_dir;
my $mods_tempdir = $self->written_modules_dir;
# the --json output is so that we can read the list of included modules
my @depak_cmd = (
"depak",
"--include-dir", $mods_tempdir,
"-i", $source, "-o", $target, "--overwrite",
"--json",
);
if (-f "depak.conf") {
push @depak_cmd, (
"--config-profile", $
e::CastleIO;
use 5.10.0;
use strict;
use warnings;
use feature 'switch';
use feature 'say';
use JSON;
use REST::Client;
use MIME::Base64;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::Pa
/api.castle.io/v1'
);
has format => (
is => 'ro',
isa => 'Str',
default => 'json'
);
has cookie_id => (
is => 'rw',
isa => 'Str'
);
has ip_address => (
is
Vjnn',
cookie_id => 'abcd',
ip_address => '24.61.128.172',
headers => JSON->new->allow_nonref->utf8->encode({'User-Agent' => 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.
=> {pygments => 'yaml'},
perl => {pygments => 'perl', sh => 'perl'},
json => {pygments => 'json', sh => 'js' },
js => {pygments => 'js' , sh => 'js' },
php
1 SEE ALSO
For syntax-highlighting (as well as encoding/formatting) to JSON, there's
L<JSON::Color> or L<Syntax::Highlight::JSON> (despite the module name, the
latter is an encoder, not strictly a st
rl.org/dist/Syntax-Highlight-Engine-Kate>),
L<Syntax::Highlight::JSON>
(L<reviews|http://cpanratings.perl.org/dist/Syntax-Highlight-JSON>),
L<Syntax::Highlight::Engine::Simple>
(L<reviews|http://cpanr
e, to be able to specify
the probe arguments as JSON. This is inspired by
the Varnish probe config block:
# This is my config file.
# It's JSON presumably...
"backends": {
"1.2.3
n
$ list_countries.pl --format=text-simple
cn
id
sg
us
# show as json, randomize order
$ list_countries.pl --format=json --random
["id","us","sg","cn"]
# only list countries which contain '
package App::Critique;
use strict;
use warnings;
use File::HomeDir ();
use JSON::MaybeXS ();
our $VERSION = '0.05';
our $AUTHORITY = 'cpan:STEVAN';
# load our CONFIG first, ...
our %CONFIG;
BEG
QUE_DATA_DIR'} || '.critique';
$CONFIG{'DATA_FILE'} = $ENV{'CRITIQUE_DATA_FILE'} || 'session.json';
$CONFIG{'COLOR'} = $ENV{'CRITIQUE_COLOR'} // 1;
$CONFIG{'DEBUG'} = $ENV{'CR
NV{'ANSI_COLORS_DISABLED'} = ! $CONFIG{'COLOR'};
}
# ... then gloablly used stuff, ....
our $JSON = JSON::MaybeXS->new->utf8->pretty->canonical;
# ... then load the app and plugins
use App::Cmd::S
d line options, and will look
something like this:
~/.critique/<git-repo>/<git-branch>/session.json
The value of C<git-repo> will be surmised from the C<git-work-tree>
which itself defaults to fin
ath->is_file;
my $file = Path::Tiny::path( $path );
my $json = $file->slurp;
my $data = $App::Critique::JSON->decode( $json );
return $class->unpack( $data );
}
sub store {
my (
= $self->{_path};
my $data = $self->pack;
eval {
# JSON might die here ...
my $json = $App::Critique::JSON->encode( $data );
# if the file does not exist
# t
>parent->mkpath unless -e $file;
# now try and write out the JSON
my $fh = $file->openw;
$fh->print( $json );
$fh->close;
1;
} or do {
Carp::confe
e
eng_name
tags
% curl 'http://localhost:5000/list_columns?table=countries&detail=1&-riap-fmt=json-pretty'
[
200,
"OK",
[
{
"pos" : 1,
"name" : "id",
"t
http://localhost:5000/api/list_tables
* Function arguments can be given via GET/POST params or JSON hash in req body
* To find out which arguments a function supports, try:
http://localhost:5
data, use the C<-riap-fmt>
special argument:
% curl http://localhost:5000/list_tables?-riap-fmt=json-pretty
[
200,
"OK",
[
"\"main\".\"continents\"",
"\"main\".\"countries\"",
Linux version 3.16.0-4-amd64 >>.
Benchmark with C<< bencher -m LogAny::NullLogging --env-hashes-json '[{"PERL5OPT":"-Iarchive/Log-Any-1.040/lib"},{"PERL5OPT":"-Iarchive/Log-Any-1.041/lib"}]' >>:
#