line:
> pegex help
> pegex compile --to=yaml your-grammar.pgx
> pegex compile --to=json your-grammar.pgx
> pegex compile --to=perl your-grammar.pgx
> pegex compile --to=perl6 yo
package Loctools::Net::OAuth2::Session;
use strict;
use JSON qw(decode_json encode_json);
use Net::OAuth2::Profile::WebServer;
sub new {
my ($class, %params) = @_;
my $session_file = $para
lf) = @_;
warn "Loading OAuth2 session from $self->{session_file}\n";
my $session = _load_json($self->{session_file}) or die $!;
$self->{token} = Net::OAuth2::AccessToken->session_thaw(
aving OAuth2 session to $self->{session_file}\n";
_save_json($self->{session_file}, $self->{token}->session_freeze());
}
sub _load_json {
my ($filename) = @_;
open IN, $filename || die "C
ON
my @dirty_files = qw< dist.ini Changes >;
my @exclude_generated_files = qw< README.pod META.json >;
class_has weaver_payload => ( ro, writer => '_store_weaver_data', isa => HashRef, lazy,
nherit_version => 1 } ], # AFTER MetaNoIndex
#MetaYAML => # core
MetaJSON => # core
# build system
ExecDir => # core
ShareDir
der top dir
exclude_filename = README.pod ; skip this generated file
exclude_filename = META.json ; skip this generated file
;[PruneCruft] ; default stuff to skip
;[ManifestSkip]
:Client;
use strict;
use HTTP::Headers;
use HTTP::Request;
use LWP::UserAgent;
use JSON qw(decode_json encode_json);
my $DEFAULT_MAX_RETRIES = 5;
sub new {
my ($class, %params) = @_;
my $
'POST', @_);
}
sub post_json {
my ($self, $url, $content, $headers) = @_;
return $self->post($url, encode_json($content), _add_json_header($headers));
}
sub put_json {
my ($self, $url, $
ncode_json($content), _add_json_header($headers));
}
sub _add_json_header {
my $headers = shift;
$headers = {} unless defined $headers;
$headers->{'Content-type'} = 'application/json; cha
c =>
'pegex compile --to=<output format> [grammar_file.pgx]';
# Output format. One of: yaml, json, perl, perl6, python.
has to => ();
# Regex format: raw, perl.
has regex => ();
# Use the boots
it / +/, $ENV{PEGEX_COMBINATE_RULES} ]
: []
},
);
my %formats = map {($_,1)} qw'yaml json perl';
my %regexes = map {($_,1)} qw'perl raw';
my %commands = map {($_,1)} qw'compile help versi
ub compile {
my ($self, $args) = @_;
my $to = $self->to or
error "--to=perl|yaml|json required";
my $regex = $self->regex ||
$to eq 'perl' ? 'perl' : 'raw';
die "'$t
=> [qw(ssh redmine.server /root/rails4_cookie_to_json.rb)],
# cmd => [qw(sudo jexec redmine /root/rails4_cookie_to_json.rb)],
},
#
://mojolicious.org');
my $cpan = await $c->ua->get_p('https://metacpan.org');
$c->render(json => {
mojo => $mojo->result->code,
cpan => $cpan->result->code
});
};
app->st
://mojolicious.org');
my $cpan = await $c->ua->get_p('https://metacpan.org');
$c->render(json => {
mojo => $mojo->result->code,
cpan => $cpan->result->code
});
};
app->st
n::Perl;
use base qw(App::Cmd::Simple);
use Catalyst::Authentication::RedmineCookie::Schema;
use JSON::MaybeXS;
use MyContainer;
sub opt_spec {
(
[ "login=s", "SELECT * FROM users WHERE
);
my $cols = sub {
my ($obj) = @_;
state $json = JSON::MaybeXS->new( canonical => 1, pretty => 1, );
$json->encode( { $obj->get_columns } );
};
say "--> user";
cmd => [qw(ssh redmine.server rails4_cookie_to_json.rb)],
cmd => [qw(sudo jexec redmine rails4_cookie_to_json.rb)],
},
# It d
1, default => 0, env => 1 };
use JSON::XS;
use LWP::UserAgent;
use Moo::Role;
use Scalar::Util qw( blessed );
with 'Net::Hadoop::YARN::Roles::Common';
my $json = JSON::XS->new->pretty(1)->canonical(
;
return { response => $content } if index( lc $type, 'json' ) == -1;
my $res;
eval {
$res = $json->decode($content);
1;
} or do {
my $eval_error = $@ || 'Zombie error';
confess q{server response wasn't valid JSON: } . $eval_error;
};
return $res;
}
my $headers = $response->headers;
my
is a good indication of when
# the SLA event happened, but that's all we have in the JSON;
# let's try using that
if (!( $alert->{lastModifiedEpoch} >= $after
package Catalyst::Authentication::Credential::RedmineCookie;
use Moose;
use IPC::Open2;
use JSON::MaybeXS qw(:legacy);
use POSIX ":sys_wait_h";
has cmd => ( is => 'ro', isa => 'Str|ArrayRef', requi
h;
my $line = <$out>;
if ( $line =~ /^{/ ) {
my $data = eval { decode_json($line) };
if ($@) {
$c->log->error("@{[ __PACKAGE__ ]} $@ line:$line"
if ($config->{debug} || !$res->{id}) {
local $Data::Dumper::Terse = 1;
print "JSON response: ", Data::Dumper::Dumper $res;
}
$self->offset($saved_offset);
$self->l
( $debug || !@{ $res->{actions} || [] } ) {
local $Data::Dumper::Terse = 1;
warn "JSON response: ", Data::Dumper::Dumper $res;
}
# return some of the response
my $ret;
and_xml_conf;
my $uri = URI->new( $self->oozie_uri );
# Jobs is supposed to be a 2-level JSON hash
my $flat_jobs = flatten($jobs);
for my $k (keys %$flat_jobs) {
my $v = $flat
NAME
Pegex::JSON - Pegex Loader for JSON
=for html
<a href="https://travis-ci.org/ingydotnet/pegex-json-pm"><img src="https://travis-ci.org/ingydotnet/pegex-json-pm.png" alt="pegex-json-pm"></a>
<a
et/pegex-json-pm?branch=master"><img src="https://coveralls.io/repos/ingydotnet/pegex-json-pm/badge.png" alt="pegex-json-pm"></a>
=head1 SYNOPSIS
my $data = Pegex::JSON->new->load($json);
=head
1 DESCRIPTION
Pegex::JSON is a JSON parser written in Pegex.
=head1 SEE ALSO
=over
=item * L<Pegex>
=item * L<JSON>
=back
=head1 AUTHOR
Ingy döt Net <ingy@cpan.org>
=head1 COPYRIGHT
Copyrig
pto::NanoRPC;
use 5.018001;
use strict;
use warnings;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [] );
our @EXPORT_OK =
'account', 'wallet', 'source', 'destination', 'link', 'json_block', 'work' ] ],
block_hash => [ 'block' ],
block_info => [ 'hash', [ 'json_block' ] ],
blocks => [ 'hashes' ],
blocks_in
n_history => [ [ 'hash' ] ],
confirmation_info => [ 'root', [ 'contents', 'representatives', 'json_block' ] ],
confirmation_quorum => [ [ 'peer_details' ] ],
database_txn_tracker => [ 'min
hashref, it can be written in
other syntaxes. It could be written in JSON, if L<JSON::Eval> is used to
inflate coderefs in the JSON:
{
"version": 1.0,
"toolkit": "Moo",
"class:Tree": {
},
"class:Maple": {
"extends": "Tree"
}
}
If this is saved at "Nature.portable.json", portable::loader should
be able to load it.
The default format that L<portable::loader> uses t
der->load($libname);
portable::loader will search for "$libname.portable.pl",
"$libname.portable.json", "$libname.portable.toml", or "$libname.portable"
(which will be assumed to be TOML). Other form
s.
=head1 JIRA ISSUE HASH FORMAT
When you work with an issue in JIRA's REST API, it gives you a JSON file that
follows this spec:
L<https://developer.atlassian.com/cloud/jira/platform/rest/#api-api
and not make you deal directly
with JSON. When you create a new issue, you can pass in just the pieces you
want and L</"create_issue"> will transform them to JSON for you. The same for
closing and de
So in those cases you'll need to pass in an
"update_hash" which will be transformed to the proper JSON by the method.
An update_hash looks like this:
{ field1 => value, field2 => value2, ...}
F
on = {
auto => 'CSV',
csv => 'CSV',
excel => 'Excel',
html => 'HTML',
json => 'JSON',
ods => 'OpenDocument',
odsxml => 'OpenDocumentXML',
text => 'CSV',
txt
item * B<format> - format of spreadsheet - 'csv', 'xls', 'xlsx', 'html', 'xhtml', 'xml', 'ods', 'json', or 'auto' (default).
=item * B<sheet> - first sheet name (optional, not supported by some form
ncer and GD
=cut
use Dancer ':syntax';
use Dancer::MIME;
use Dancer::Plugin;
use GD::Image;
use JSON::MaybeXS;
use List::Util qw( min max );
use Object::Signature;
use POSIX 'strftime';
=head1 VER
al Server Error';
};
# store serialized meta information (for future using)
print FH encode_json({
args => \@_,
compression => $compression,
conf => $conf,
format => $fmt,