;
use Method::Signatures 20140224;
use List::MoreUtils qw(any);
use Carp qw( croak );
use JSON qw( encode_json );
use Moo;
use namespace::clean;
# ABSTRACT: Freshservice User Custom Field
our $VERSI
put_api( "itil/requesters/".$self->id.".json", $data);
return 1;
}
# Internal method that returns a clean perl data structure
# for encode_json
method TO_JSON {
return $self->value;
}
1;
__END_
use strict;
use warnings;
use 5.12.0;
use REST::Client;
use JSON;
use vars qw($VERSION);
$VERSION = '1.001';
=head1 NAME
WebService::IFConfig::Client - Client for Martin Polden's https://ifconfig.
0 means do not run until a request is made.
server https://ifconfig.co/json IPD Server, but you can run your own and provide it here.
=cut
# Whether to run immediately
nfig.co/json',
reader => 'get_server',
writer => 'set_server'
);
has '_json' => (
is => 'ro',
isa => 'HashRef',
default => sub { {} },
reader => '_get_json',
w
::Validate::IP qw/is_ipv4 is_ipv6 is_public_ipv4/;
use SimpleR::Reshape;
use Data::Dumper;
use JSON;
use File::Spec;
use Net::CIDR qw/cidr2range/;
use Socket qw/inet_aton inet_ntoa/;
use Memoiz
ThreatStack;
use 5.10.0;
use strict;
use warnings;
use feature 'switch';
use feature 'say';
use JSON;
use REST::Client;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::Params::Validate;
POST') {
my $json_args = JSON->new->allow_nonref->utf8->encode($params{args}{data});
say "[_call]: Making call POST $url" if $self->debug;
$client->POST($url, $json_args, $headers)
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";
}
#!/usr/bin/perl
use JSON;
use Encode;
use Data::Validate::IP;
use FindBin;
$|=1;
our $DATA_DIR='data';
our $PRIVATE = {
country => '局域网',
region => '局域网',
isp => '局域网'
my $c = `/usr/bin/curl -s "$url"`;
my $r;
eval {
$r = decode_json($c);
};
unless($r){
print "retry $ip\n";
sleep 3;
ion 1.11
=head1 SYNOPSIS
Zabbix check for disk
=cut
use strict;
use warnings;
use v5.10.1;
use JSON;
use Lazy::Utils;
use Zabbix::Check;
BEGIN
{
require Exporter;
our $VERSION = '1.11';
o
eval { $stats = from_json($tmp) } if $tmp;
}
next;
}
if (not $old_stats)
{
my $tmp = file_get_contents($tmp_path);
eval { $old_stats = from_json($tmp) } if $tmp;
next
}
unlink($tmp_path);
}
unless ($stats)
{
$stats = stats();
my $tmp;
eval { $tmp = to_json($stats, {pretty => 1}) };
file_put_contents("$tmp_prefix$now.$$", $tmp) if $tmp;
}
return unl
# ABSTRACT: JsonSQL::Param::Order object. Stores a Perl representation of an SQL ORDER BY clause for use in JsonSQL::Query objects.
use strict;
use warnings;
use 5.014;
package JsonSQL::Param::Ord
$VERSION = '0.41'; # VERSION
use List::Util qw( any );
use JsonSQL::Param::Field;
use JsonSQL::Error;
## These are validated by the JSON schema, but an extra check doesn't hurt.
my @validDirs = ('
my $orderField = JsonSQL::Param::Field->new($orderhashref->{field}, $queryObj, $default_table_rules);
if ( eval { $orderField->is_error } ) {
return JsonSQL::Error->new("invalid_f
Defines an error object to be used at various stages of JSON validation and SQL generation.
use strict;
use warnings;
use 5.014;
package JsonSQL::Error;
our $VERSION = '0.41'; # VERSION
sub new
NAME
JsonSQL::Error - Defines an error object to be used at various stages of JSON validation and SQL generation.
=head1 VERSION
version 0.41
=head1 SYNOPSIS
To use this:
return JsonSQL::Er
ptions/>
=head1 METHODS
=head2 Constructor new($type, $message)
Instantiates and returns a new JsonSQL::Error object.
$type => Any string to group error messages by.
$message => The
# ABSTRACT: JsonSQL distribution. A collection of modules for generating safe SQL from JSON strings.
use strict;
use warnings;
use 5.014;
package JsonSQL;
our $VERSION = '0.41'; # VERSION
1;
AME
JsonSQL - JsonSQL distribution. A collection of modules for generating safe SQL from JSON strings.
=head1 VERSION
version 0.41
=head1 SYNOPSIS
This is a set of modules used to turn a JSON str
esenting an SQL query into an appropriate SQL statement.
For example,
use JsonSQL::Query::Select;
my $jsonString = '{
"fields": [
{"column": "*"}
],
ABSTRACT: JSON schema validation module. Returns a JsonSQL::Validator object for validating a JSON string against a pre-defined schema.
use strict;
use warnings;
use 5.014;
package JsonSQL::Valida
JSON::Validator;
use JSON::Parse qw( assert_valid_json parse_json );
use List::Util qw( any );
use JsonSQL::Schemas::Schema;
use JsonSQL::Error;
#use Data::Dumper;
sub new {
my ( $class, $json
ified JSON schema.
my $schema = JsonSQL::Schemas::Schema->load_schema($jsonSchema);
if ( eval { $schema->is_error } ) {
return JsonSQL::Error->new("validate", "Error loading JSON schem
# ABSTRACT: JsonSQL::Query::Insert object. Stores a Perl representation of a set of INSERT statements created from a JSON string.
use strict;
use warnings;
use 5.014;
package JsonSQL::Query::Inser
# VERSION
use base qw( JsonSQL::Query::Query );
use JsonSQL::Validator;
use JsonSQL::Error;
use JsonSQL::Param::Insert;
sub new {
my ( $class, $query_rulesets, $json_query, $quote_char ) = @
from JsonSQL::Query::Query base class.
my $self = $class->SUPER::new($query_rulesets, 'insert', $quote_char);
if ( eval { $self->is_error } ) {
return (0, "Could not create JsonSQL IN
# ABSTRACT: JSON query base class. Provides the quote_identifier method for escaping table and column identifiers.
use strict;
use warnings;
use 5.014;
package JsonSQL::Query::Query;
our $VERSION
= '0.41'; # VERSION
use JsonSQL::Validator;
sub new {
my ( $class, $query_rulesets, $json_schema, $quote_char ) = @_;
## DB specific values can be used in the future, but for now we a
> $quoteChar
};
# Get a JsonSQL::Validator object with the provided $json_schema and $query_rulesets.
my $validator = JsonSQL::Validator->new($json_schema, $query_rulesets);
if (
# ABSTRACT: JsonSQL::Query::Select object. Stores a Perl representation of a SELECT statement created from a JSON string.
use strict;
use warnings;
use 5.014;
package JsonSQL::Query::Select;
our
e qw( JsonSQL::Query::Query );
use JsonSQL::Validator;
use JsonSQL::Error;
use JsonSQL::Param::Fields;
use JsonSQL::Param::Field;
use JsonSQL::Param::Tables;
use JsonSQL::Param::Joins;
use JsonSQL::P
aram::ConditionDispatcher;
use JsonSQL::Param::OrderBy;
# Using this as a crutch for now, but will deprecate at some point.
use SQL::Maker::Select;
#use Data::Dumper;
#use constant DEBUG => 0; # tog
ACT: JsonSQL 'insert' JSON schema.
use strict;
use warnings;
use 5.014;
package JsonSQL::Schemas::insert;
our $VERSION = '0.41'; # VERSION
use base qw( JsonSQL::Schemas::Schema );
my $jsonSche
QL Insert Schema",
"id": "sqlInsertSchema",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "JSON schema to describe an SQL INSERT",
"type": "object",
"propert
SUPER::new();
$self->{_json} = $jsonSchema;
return $self;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JsonSQL::Schemas::insert - JsonSQL 'insert' JSON schema.
=head1 VERSION
v
package HBase::JSONRest;
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use URI::Escape;
use MIME::Base64;
use JSON::XS qw(decode_json encode_json);
use Time::HiRes qw(gettimeofday time);
use D
ers => {
'Accept' => 'application/json',
}
});
return if $self->_handle_error( $uri, $rs );
my $response = decode_json($rs->{content});
my @tables = ();
fo
ers => {
'Accept' => 'application/json',
}
});
return if $self->_handle_error( $uri, $rs );
my $response = decode_json($rs->{content});
return $response;
}
#
ACT: JsonSQL 'select' JSON schema.
use strict;
use warnings;
use 5.014;
package JsonSQL::Schemas::select;
our $VERSION = '0.41'; # VERSION
use base qw( JsonSQL::Schemas::Schema );
my $jsonSche
QL Select Schema",
"id": "sqlSelectSchema",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "JSON schema to describe an SQL SELECT query",
"type": "object",
"p
SUPER::new();
$self->{_json} = $jsonSchema;
return $self;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JsonSQL::Schemas::select - JsonSQL 'select' JSON schema.
=head1 VERSION
v
# ABSTRACT: JSON schema base class. Used as a dispatcher for loading JSON schema objects used by JsonSQL::Validator.
use strict;
use warnings;
use 5.014;
package JsonSQL::Schemas::Schema;
our $VER
SION = '0.41'; # VERSION
use Class::Load qw( try_load_class );
use JSON::Parse qw( parse_json );
use JsonSQL::Error;
sub new {
my $class = shift;
my $self = {};
bless $self,
class;
return $self;
}
sub load_schema {
my ( $caller, $jsonSchema ) = @_;
my $class = "JsonSQL::Schemas::" . $jsonSchema;
my ( $success, $err ) = try_load_class($class);
rom Redis
$1: I<bind, by defaut 127.0.0.1:6379>
=cut
use strict;
use warnings;
use v5.10.1;
use JSON;
use Net::NTP;
use Lazy::Utils;
BEGIN
{
require Exporter;
our $VERSION = '1.12';
our @IS
$newkey => $newval;
} keys(%$item));
\%newitem;
} @items),
],
};
my $result = to_json($discovery, {pretty => 1});
print $result;
return $result;
}
sub _version
{
my $result = "";
ck
=head1 DEPENDENCIES
This module requires these other modules and libraries:
=over
=item *
JSON
=item *
Net::NTP
=item *
Lazy::Utils
=back
=head1 REPOSITORY
B<GitHub> L<https://github.co
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