iny->new;
require JSON::XS;
$self->{_json} = JSON::XS->new;
require URI::Encode;
$self->{_urienc} = URI::Encode->new;
bless $self, $class;
}
sub _get_json {
my ($self, $url
) = @_;
log_trace("JSON API request: %s", $url);
my $res = $self->{_http}->get($url);
die "Can't retrieve $url: $res->{status} - $res->{reason}"
unless $res->{success};
my $d
ecoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace("JSON API response: %s", $decoded);
$decoded;
}
sub t
initialized redefine );
use CGI();
use Carp('confess');
use POSIX();
use DBIx::OptimalQuery;
use JSON::XS;
# some tools that OQ auto activates
use CGI::OptimalQuery::ExportDataTool();
use CGI::Optim
use warnings;
use parent qw{App::Prove::Elasticsearch::Queue::Default};
use Net::RabbitMQ;
use JSON::MaybeXS;
sub new {
my ($class, $input) = @_;
my $self = $class->SUPER::new($input);
}
require HTTP::Tiny;
$self->{_http} = HTTP::Tiny->new;
require JSON::XS;
$self->{_json} = JSON::XS->new;
require URI::Encode;
$self->{_urienc} = URI::Encode->new;
my $encoded_body = '';
if ($method eq 'POST') {
$body = $encoded_body = $self->{_json}->encode($params);
} else {
if (keys %$params) {
my $qs = '?' . join(
phrase}) x !!$is_private,,
"Content-Type" => "application/json",
"Accept" => "application/json",
},
(content => $body) x !!defined($body),
};
ry::InteractiveQuery',
'XML' => 'CGI::OptimalQuery::XML',
'JSON' => 'CGI::OptimalQuery::JSON',
'InteractiveQuery2' => 'CGI::OptimalQuery::InteractiveQuery2',
'Intera
t plural.
(This example is included as L<F<synopsis.pl>|https://fastapi.metacpan.org/source/BKB/JSON-Parse-0.21/examples/synopsis.pl> in the distribution.)
=head1 VERSION
This documents Lingu
package IP::IPwhere;
use 5.006;
use strict;
use warnings;
use Data::Dumper;
use LWP::Simple;
use JSON;
use Encode;
use utf8;
our @ISA = qw(Exporter);
our @EXPORT =
qw(squery query getTbeIParea get
法: ./ipwhere.pl 8.8.8.8 8.8.8.6
需要安装perl及扩展LWP::Simple;use JSON;
建议通过cpanm LWP::Simple JSON 一键安装。
=head1 VERSION
Version 0.05
=cut
our $VERSION = '0.06';
=
8&oe=gbk&format=json);
my $code = get($url);
#my $jso=$1 if $code =~/var remote_ip_info =(.*);$/;
print $code, "\n" if $DEBUG;
my $json = new JSON;
my $obj = $json->decode($code)
$path (@{$self->paths}) {
# for my $file (catfile($path, $id.".js"), catfile($path, $id.".json")) {
# return $file if -f $file;
# }
my $file = $self->_resolve_relat
e.json
if (-f "$basepath.json") {
return $self->_validate_module_path("$basepath.json");
}
# module/package.json
if (-f (my $package_file = catfile($basepath, "package.json")
)) {
# parse JSON
my $json = _slurp($package_file);
my $main = $self->eval("($json).main");
if ($main) {
my $file = catfile($basepath, $main);
a::Client 0.6;
use strict;
use warnings;
use Carp 'croak';
use Crypt::OpenSSL::RSA;
use JSON::Parse 'parse_json';
use LWP::UserAgent;
use MIME::Base64 'encode_base64';
use Net::SSH::Perl::Key;
sub n
mkdir {
my ($self, $path) = @_;
return $self->put(path => $path, "content-type" => "application/json; type=directory");
}
sub ls {
# FIXME - limited to 256 objects
my ($self, $path) = @_;
my $re
plit '\n', $response) {
my $json = parse_json($_);
$results{$json->{name}} = { type => $json->{type}, mtime => $json->{mtime}, size => $json->{size}, etag => $json->{etag} };
}
return \%resu
ge Mojolicious::Service::SessionFile;
use Mojo::Base 'Mojolicious::Service';
use Mojo::JSON qw/from_json to_json/;
use Mojo::File 'path';
use Encode qw/decode_utf8 encode_utf8/;
use Mojo::Cache;
has
my $file_content = -e $file ? $file->slurp : undef;
if($file_content){
$session = from_json(decode_utf8 $file_content);
# 从session文件中取到后需要设置缓存
$self->c
ft;
my $home = $self->app->home;
$home->child($self->path, $session_id)->spurt(encode_utf8(to_json($session)));
# 存储session文件后需要设置缓存
$self->cache->set($session_id => $ses
se namespace::autoclean;
use Data::Dumper;
use YAML;
use Storable qw(dclone);
use Try::Tiny;
use JSON;
extends 'BioX::Workflow::Command';
use BioSAILs::Utils::Traits qw(ArrayRefOfStrs);
use Capture:
=> 'rw',
isa => 'Str',
required => 0,
predicate => 'has_path',
);
option 'json' => (
is => 'rw',
isa => 'Bool',
default => 0,
);
option 'show_only_errors'
$self->app_log->warn('Exiting now.');
return;
}
$DB::single = 2;
if ( $self->json ) {
capture_stderr {
$self->inspect;
};
}
else {
$se
use File::Slurp;
use JSON;
use Try::Tiny;
has 'remove_from_json' => (
is => 'rw',
isa => 'ArrayRef',
default => sub {
[
'remove_from_json', 'register_namespac
o_json {
my $self = shift;
my $file = shift;
my %hacky_self = %{$self};
foreach my $remove ( @{ $self->remove_from_json } ) {
delete $hacky_self{$remove};
}
my $json
= JSON->new->utf8->pretty->allow_blessed->encode( \%hacky_self );
if ($file) {
write_file( $file, $json );
}
return $json;
}
sub read_json_file {
my $self = shift;
my $fi
he other functions we need to process a rule
1. Do a sanity check of the rule - it could be yaml/json friendly but not biox friendly
2. Clone the local attr
3. Check for carrying indir/outdir INPUT/O
use English qw{ -no_match_vars };
use Sys::Syslog qw{:standard :macros};
use ClamAV::Client;
use JSON;
use Mail::AuthenticationResults::Header::Entry;
use Mail::AuthenticationResults::Header::SubEntr
> 1,
};
}
sub grafana_rows {
my ( $self ) = @_;
my @rows;
push @rows, $self->get_json( 'ClamAV_metrics' );
return \@rows;
}
sub register_metrics {
return {
'clamav_to
' ],
};
}
sub grafana_rows {
my ( $self ) = @_;
my @rows;
push @rows, $self->get_json( 'UserDB_metrics' );
return \@rows;
}
sub register_metrics {
return {
'userdb_to
yes',
}
}
sub grafana_rows {
my ( $self ) = @_;
my @rows;
push @rows, $self->get_json( 'SpamAssassin_metrics' );
return \@rows;
}
sub register_metrics {
return {
'spa
ter
use English qw{ -no_match_vars };
use Sys::Syslog qw{:standard :macros};
use HTTP::Tiny;
use JSON;
use Mail::AuthenticationResults::Header::Entry;
use Mail::AuthenticationResults::Header::SubEntr
yes',
}
}
sub grafana_rows {
my ( $self ) = @_;
my @rows;
push @rows, $self->get_json( 'RSpamD_metrics' );
return \@rows;
}
sub register_metrics {
return {
'rspamd_to
lf->metric_count( 'rspamd_total', $self->{ 'metrics_data' } );
return;
}
my $j = JSON->new();
my $rspamd_data = eval{ $j->decode( $response->{'content'} ); };
$self->handle_ex
authority =~ s/^cpan://i;
return $authority;
}
}
sub _parse_meta {
for my $file (qw/META.json META.yml/) {
next unless -f $file && -r _;
my $meta = Parse::CPAN::Meta->load_file($file)
{
builder => 'create_reg_attr',
lookup => [
'.*_json$', '.*_yaml$', '.*_yml$', '.*_jsn$',
]
}
);
$self->set_register_pro
{
builder => 'process_directive_config',
lookup => [
'.*_json$', '.*_yaml$', '.*_yml$', '.*_jsn$',
],
}
);
};
=head3 process_directive
my ($tfh, $tfilename) = tempfile();
my ($jfh, $jfilename) = tempfile();
my $json = $self->serialize_to_json($jfilename);
write_file($tfilename, $source);
#
my $cmd = 'biosails-bio