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
package WWW::RiotGames::LeagueOfLegends;
use strict;
use warnings;
use Moo;
use LWP;
use JSON;
use URI;
use Sub::Name;
use Types::Standard qw(Str Int Enum InstanceOf Bool);
use Function::Parameters;
eout => (
is => 'rw',
isa => Int,
lazy => 1,
default => sub { 5 },
);
has json => (
isa => InstanceOf['JSON'],
is => 'lazy',
handles => [ qw(decode) ],
);
has debug => (
is => 'rw',
' ' . $VERSION, ssl_opts => { verify_hostname => 0, SSL_verify_mode => 0x00 } );
}
sub _build_json { JSON->new->utf8->allow_nonref }
method champion_mastery( Int :$summoner_id, Int :$champion_id = 0
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
:SlackRTM;
use Mojo::Base 'Mojo::EventEmitter';
use IO::Socket::SSL;
use Mojo::IOLoop;
use Mojo::JSON ();
use Mojo::Log;
use Mojo::UserAgent;
use Scalar::Util ();
use constant DEBUG => $ENV{MOJO_SLA
b {
my $tx = shift;
return if $tx->success and $tx->res->json("/ok");
if ($tx->success) {
my $error = $tx->res->json("/error") || "Unknown error";
return $error;
} else
get $SLACK_URL/rtm.start?token=XXX: $error");
return;
}
my $metadata = $tx->res->json;
$self->metadata($metadata);
my $url = $metadata->{url};
$self->ua->websocket($url =>
package Captcha::noCAPTCHA;
use warnings;
use strict;
use HTTP::Tiny;
use JSON::PP qw();
our $VERSION = '0.16'; # VERSION
sub new {
my ($class,$args) = @_;
my $self = bless {} ,$class;
$self->si
$json = eval {JSON::PP::decode_json($response->{content})};
if (!$json) {
$self->{_attrs}->{errors} = ['invalid-json'];
return;
}
$self->{_response} = $json;
$self->{_attrs}->{errors} = $json-
>{'error-codes'};
return $json->{success};
}
sub _get_set {
my ($self,$name,@args) = @_;
$self->{_attrs}->{$name} = $args[0] if (@args);
return $self->{_attrs}->{$name};
}
1;
=head1 NAME
Captc
$self->mainstore( _defined_or( $hash{mainstore}, $cfg->val('MASTER','mainstore' ), 'cpanstats-%s.json' ));
$self->templates( _defined_or( $hash{templates}, $cfg->val('MASTER','templates' ) ));
to manage the creation of all the statistics graphs.
=item * storage
Method to return specific JSON data currently stored.
=cut
__PACKAGE__->mk_accessors(
qw( directory mainstore templates ad
sh a notification on Slack after release
use Moose;
with 'Dist::Zilla::Role::AfterRelease';
use JSON;
use LWP::UserAgent;
use Dist::Zilla::Plugin::EmailNotify;
use namespace::autoclean;
has webhoo
= $ua->post( $self->webhook_url,
'Content-Type' => 'application/json',
Content => encode_json( \%payload ),
);
}
return $res->is_success;
}
sub _build_
2 app.
use strict;
use warnings;
use Dancer2::Plugin;
use Dancer2::Plugin::Cart::InlineViews;
use JSON;
our $VERSION = '1.0001'; #Version
BEGIN{
has 'product_list' => (
is => 'ro',
from_c
d by the Pages module to create the leaderboard pages.
Previously this information was held in a JSON file, but maintaining accurate
data has been problematic.
Note that this package should not be c
istribution Log-ger-Layout-YAML), released on 2017-06-28.
=head1 SYNOPSIS
use Log::ger::Layout JSON => (
add_fields => {key3 => 'value', key4 => 'value', ...}, # optional
pec qw/catfile/;
use Getopt::Long;
use Path::Tiny;
use Hash::Flatten;
use Cwd;
use Net::Etcd;
use JSON;
use YAML::Syck;
use Path::Class qw( file );
use File::Spec;
use Try::Tiny;
use Data::Dumper;
us
#special handle HASH refs ( interpret as json)
if ( ( ref($res) eq 'HASH' ) and $response->wantformat('json') ) {
$res = $response->set_json( $res );
}
#check if response moda
$data;
return $self;
}
sub json : lvalue {
my $self = shift;
$self->{__json};
}
sub set_json {
my $self = shift;
my $data = shift;
$self->json = $data;
return $self;
}
:Basename;
use File::Copy;
use File::Path;
use File::Slurp;
use HTML::Entities;
use IO::File;
use JSON;
use Sort::Versions;
use Template;
#use Time::HiRes qw ( time );
use Time::Piece;
use Try::Tiny;
item * update_full
Full update of data and pages.
=item * update_data
Update data and store in JSON format.
=item * build_basics
Create the basic set of pages,those require no statistical calcula
return unless(-f $storage);
my $data = read_file($storage);
my $store = decode_json($data);
return $store->{$type};
}
# for $type (qw(stats dists fails perls pass pl
t::Encoder::JSONXS;
$instance = Plack::Session::Store::RedisFast::Encoder::JSONXS->new;
1;
} or do {
require Plack::Session::Store::RedisFast::Encoder::MojoJSON;
$i
ast::Encoder::MojoJSON->new;
}
or do {
require Plack::Session::Store::RedisFast::Encoder::JSON;
$instance = Plack::Session::Store::RedisFast::Encoder::JSON->new;
};
en through L</redis> param.
Default implementation of serializer handle is L<JSON::XS>; otherwise L<Mojo::JSON> or L<JSON>.
May be overriden through L</inflate> and L</deflate> param.
=head1 SYNOPS
(sub { $_->proxy->detect })
->get('fastapi.metacpan.org/v1/release/Minion')
->result->json->{version};
} or return;
my $msg = 'This version is up to date, have fun!';
$msg = 'Thank
encoding utf-8
=head1 NAME
Plack::Session::Store::RedisFast::JSON - L<JSON> adapter for Redis session store.
=head1 DESCRIPTION
L<JSON>-based implementation of L<Plack::Session::Store::RedisFast/i
eflate>.
=head1 SYNOPSIS
use Plack::Session::Store::RedisFast::JSON;
my $encoder = Plack::Session::Store::RedisFast::JSON->new;
my $bytes = $encoder->encode( $hashref );
my $hashr
coder->decode( $bytes );
=head1 DESCRIPTION
Used by default when L<JSON::XS> and L<Mojo::JSON> are not available.
=head1 METHODS
=head2 new
Plack::Session::Store::RedisFast::JSON->new;
=cut
package Plack::Session::Store::RedisFast::Encoder::JSONXS;
use strict;
use warnings;
use 5.008_005;
use JSON::XS ();
sub new {
return JSON::XS->new->utf8->allow_nonref;
}
1;
__END__
=pod
=
oding utf-8
=head1 NAME
Plack::Session::Store::RedisFast::JSONXS - L<JSON::XS> adapter for Redis session store.
=head1 DESCRIPTION
L<JSON::XS>-based implementation of L<Plack::Session::Store::Redi
flate>.
=head1 SYNOPSIS
use Plack::Session::Store::RedisFast::JSONXS;
my $encoder = Plack::Session::Store::RedisFast::JSONXS->new;
my $bytes = $encoder->encode( $hashref );
my $ha
ackage Plack::Session::Store::RedisFast::Encoder::MojoJSON;
use strict;
use warnings;
use 5.008_005;
use Mojo::JSON qw( decode_json encode_json );
sub new {
my ($class) = @_;
bless {}, $c
e_json($thing);
}
sub decode {
my ( $self, $bytes ) = @_;
decode_json($bytes);
}
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Plack::Session::Store::RedisFast::MojoJSON - L<Mojo::JSON>
ojo::JSON>-based implementation of L<Plack::Session::Store::RedisFast/inflate>
and L<Plack::Session::Store::RedisFast/deflate>.
=head1 SYNOPSIS
use Plack::Session::Store::RedisFast::MojoJSON;
::Client::VERSION = '1.1000';
use HTTP::Thin;
use HTTP::Request::Common;
use HTTP::CookieJar;
use JSON;
use URI;
use Ouch;
use Moo;
=head1 NAME
Wing::Client - A simple client to Wing's web services
_process_response {
my $self = shift;
my $response = shift;
my $result = eval { from_json($response->decoded_content) };
if ($@) {
ouch 500, 'Server returned unparsable conte
ta};
}
}
=head1 PREREQS
L<HTTP::Thin>
L<Ouch>
L<HTTP::Request::Common>
L<HTTP::CookieJar>
L<JSON>
L<URI>
L<Moo>
=head1 SUPPORT
=over
=item Repository
L<http://github.com/rizen/Wing-Client>