use 5.12.0;
use warnings;
use Data::Dumper;
use File::Slurp;
use Getopt::Long;
use IO::Wrap;
use JSON;
use LWP::UserAgent;
use Pod::Usage;
use Text::CSV_XS;
use Text::Table;
use Try::Tiny;
my $url =
ocalhost:8080';
my $username;
my $password;
my $help = 0;
my $config_file = '/etc/disbatch/config.json';
my $ssl_ca_file;
my $disable_ssl_verification = 0;
GetOptions(
'url|u=s' => \$url,
ication,
);
pod2usage(-verbose => 2, -exitval => 0) if $help;
pod2usage(1) unless @ARGV;
my $json = JSON->new;
my $options = {};
if (defined $ssl_ca_file) {
$options->{ssl_opts}{SSL_ca_file} =
:OAuth;
use Mojo::Base 'Mojolicious::Plugin::Web::Auth::Base';
use Net::OAuth::Client;
use Mojo::JSON;
has 'request_token_url';
has is_v1a => 0;
has token_key => 'token';
has token_
or}->( $res->decoded_content )
unless ( $res->is_success );
push @args, Mojo::JSON::j( $res->decoded_content );
} else {
push @args, undef;
}
return $callback-
d %s', $res->code, $res->default_message ) )
if $tx->error;
push @args, $res->json;
} else {
push @args, undef;
}
push @args, { %$dat }; # append rest of the r
->type(json => ['application/json', 'text/javascript']);
my $exts = $types->detect( $res->headers->content_type );
return ( scalar(@$exts) && $exts->[0] eq 'json' )
? $res->json
zens that L<Dancer> pulls in.
B<Limper> is modular - support for serving files, easily returning JSON, or
using PSGI can be included if and only if needed (and these features already
exist on CPAN).
ng to Limper, see L<Limper::Sugar>.
For sending files and easily sending JSON, see L<Limper::SendFile> and L<Limper::SendJSON>.
For differences between Limper and Dancer, see L<Limper::Differences>.
ad1 SEE ALSO
L<Limper::Differences>
L<Limper::Extending>
L<Limper::Engine::PSGI>
L<Limper::SendFile>
L<Limper::SendJSON>
L<Limper::Sugar>
L<App::FatPacker>
L<IO::Socket::INET>
L<Web::Simple>
sr/bin/env perl
# more complex example returning JSON or static content
use 5.10.0;
use strict;
use warnings;
use Limper;
use File::Slurp;
use JSON;
my $document_root = './public/';
my $static =
;
'blegh';
}
};
my $generic = sub {
headers('Content-Type' => 'application/json');
JSON->new->encode({status => 'OK'});
};
get qr{^/} => $static;
post qr{^/} => $generic;
limp(L
^-?[0-9]+ float^-?[0-9]+.[0-9]+
=item C<< optional_data : json_string >>
Additional information other than quantity. It is specified as JSON string.
The amount of this data must be less than 10 KB.
^-?[0-9]+ float^-?[0-9]+.[0-9]+
=item C<< optional_data : json_string >>
Additional information other than quantity. It is specified as JSON string.
The amount of this data must be less than 10 KB.
bService::Pixela::Webhook;
use 5.010001;
use strict;
use warnings;
use Carp qw/croak/;
use JSON qw/decode_json/;
our $VERSION = "0.021";
sub new {
my ($class,$pixela_client) = @_;
return ble
der('POST',$path,$params);
my $res_json = $self->client->decode() ? $res : decode_json($res);
if($res_json->{isSuccess}){
$self->hash($res_json->{webhookHash});
}
return $re
se WebService::Pixela;
# All WebService::Pixela methods use this token and user name in URI, JSON, etc.
my $pixela = WebService::Pixela->new(token => "thisissecret", username => "testname");
se WebService::Pixela;
# All WebService::Pixela methods use this token and user name in URI, JSON, etc.
my $pixela = WebService::Pixela->new(username => $username, token => $token);
my $g
initions.
If you setting I<$pixela->decode(1) [default]> return array refs.
Otherwise it returns json.
See Also L<https://docs.pixe.la/#/get-graph>
=head4 C<< $pixela->graph->get_svg(%args) >>
I<%
se WebService::Pixela;
# All WebService::Pixela methods use this token and user name in URI, JSON, etc.
my $pixela = WebService::Pixela->new(token => "thisissecret", username => "testname");
strict;
use warnings;
use Path::Tiny;
use Moo::Role;
use MooseX::MungeHas;
use IPC::Run3;
use JSON;
use Module::Runtime qw/ use_module /;
use List::AllUtils qw/ uniq /;
use experimental 'postdere
task rc.recurrence=no rc.hooks=off export /, @query], undef, \my $out;
return eval { @{ from_json $out } };
}
sub new_task {
my ( $self, $task ) = @_;
$task ||= {};
return Taskwar
ew( $self->run_task, $task );
}
sub import_task {
my( $self, $task ) = @_;
my $in = to_json $task;
run3 [qw/ task rc.recurrence=no import /], \$in;
}
sub calc {
my( $self, @stuff
=> 'code';
has access_token_url => 'https://oauth.yandex.ru/token';
has user_info_url => 'https://login.yandex.ru/info?format=json';
has authorize_header => 'OAuth';
sub moniker {'yandex'};
1;
'current_sid',
'message_count',
],
};
use strict;
use warnings;
use URI;
use JSON;
use Net::NATS::Connection;
use Net::NATS::Message;
use Net::NATS::ServerInfo;
use Net::NATS::Co
or return;
$self->connection($connection);
}
my $connect = 'CONNECT ' . to_json($connect_info, { convert_blessed => 1});
$self->connection->send($connect);
return 1;
}
', $line);
}
sub handle_info {
my $self = shift;
my (@args) = @_;
my $hash = decode_json($args[0]);
return Net::NATS::ServerInfo->new(%$hash);
}
sub parse_msg {
my $self = shift
use Carp;
use File::Basename;
use Modern::Perl;
use Capture::Tiny ':all';
use Clone 'clone';
use JSON;
use DBI;
use Geo::GDAL;
use HTTP::Date;
use File::MkTemp;
use Data::Dumper;
use XML::LibXML::Pr
ree' => 'GML3Deegree',
'application/gml+xml; version=3.2' => 'GML3.2',
'application/json' => 'GeoJSON',
);
our @GDAL_GML_Creation_options = (qw/XSISCHEMAURI XSISCHEMA PREFIX
STRIP_PREFIX TARG
) }
}
}
=pod
=head3 GetCapabilities
Service the GetCapabilities request. The configuration JSON is used to
control the contents of the reply. The config contains root keys, which
are either sim
lf->pedantic;
$self->ssl_required(0) unless $self->ssl_required;
return $self;
}
sub TO_JSON {
my $self = shift;
my $hash = { %{ $self } };
$hash->{verbose} = $self->verbose ? \1
re JSON;
my %filter = ( state => 'open' );
$filter{assignee} = $self->tw->config->{github}{user} unless $self->tw->config->{github}{user} eq $org;
my $user_filter = eval {
JSON::f
rom_json $self->tw->{config}{project}{$project}{filter}
};
%filter = ( %filter, %$user_filter ) if $user_filter;
say "syncing tickets for $org/$repo...";
my %tasks = map { $_->{gh_i
ady found locally";
say "fetching open tickets from Github...";
say "using filter ", JSON::to_json( \%filter );
my @issues = $self->github->issue->repos_issues(
$org, $repo, \%fi
-i -X POST http://service01a-c2.cpanel.net:9696/v2.0/floatingips
# -H "Content-Type: application/json" -H "User-Agent: openstacksdk/0.27.0 keystoneauth1/3.13.1 python-requests/2.21.0 CPython/3.6.6" -
st;
$reg->respond([
200, 'ok', { 'Content-Type' => 'application/json'},
to_json($calendar_entries)
]);
},
GET => '/static-files/*' => sub {
= '4.103';
use 5.12.0;
use warnings;
use Cpanel::JSON::XS;
use Disbatch::Web; # exports: parse_params send_json_options template
use Limper::SendJSON;
use Limper;
use MongoDB::OID 1.0.4;
use Safe::Is
##########
get '/scheduler-json' => sub {
undef $disbatch->{mongo};
send_json $disbatch->scheduler_report_old_api, send_json_options;
};
post '/set-queue-attr-json' => sub {
undef $disba
;
return send_json { success => 0, error => 'Invalid attr'}, send_json_options;
}
unless (defined $params->{value}) {
status 400;
return send_json {success => 0, error
use Path::Tiny;
use Hash::Merge qw/merge /;
use List::AllUtils qw/ reduce pairmap pairmap /;
use JSON;
use experimental 'postderef';
with 'Taskwarrior::Kusarigama::Core';
has raw_args => (
is
hod = join '_', 'run', $event;
my @plugins = $self->plugins->@*;
my @tasks = map { from_json($_) } <STDIN>;
try {
$self->$method(\@plugins,@tasks);
}
catch {
say
on_add($task) for grep { $_->DOES('Taskwarrior::Kusarigama::Hook::OnAdd') } @$plugins;
say to_json($task);
}
# TODO document the $old, $new, $diff
sub run_modify {
my( $self, $plugins, $old
my( $self, $task ) = @_;
require JSON;
my $id = $task->{uuid} || '+LATEST';
my $json = JSON::to_json([ $task ]);
$self->RUN('import', \$json );
my ( $new ) = $self->export($i
xport {
my( $self, @args ) = @_;
require JSON;
return map {
Taskwarrior::Kusarigama::Task->new( $self => $_ )
} JSON::from_json( join '', $self->RUN( export => @args ) )->@*;