;
use Carp qw/croak/;
use ExtUtils::MakeMaker qw/prompt/;
use File::Which qw/which/;
use JSON::PP qw/decode_json/;
use Path::Tiny qw/path/;
use POSIX qw(setlocale LC_TIME);
use Scope::Guard qw/guard/;
t_tag = shift;
my $data = eval { decode_json scalar `ghch -f v$current_tag` };
if ($! || $@ || $?) {
die "calling ghch and/or decoding json failed: $@";
}
return grep {$_->{ti
sta::Scrap::RedditScrapper;
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Encode qw(encode);
our $VERSION = '1.00';
sub new {
my $class = shift;
my $self =
my $base = "https://www.reddit.com/r/";
my $url = $base . $subreddit->{name} . "/new.json?limit=" . ( $subreddit->{limit} || 5 );
my $r = HTTP::Request->new( 'GET', $url );
my @subreddits = ();
if ( $response->is_success ) {
my $responseContent = decode_json $response->decoded_content;
my @children = @{ $responseContent->{data}->{children}
package Mojolicious::Plugin::JsonRpcDispatcher;
use Mojo::Base 'Mojolicious::Plugin';
use MojoX::JSON::RPC::Dispatcher;
sub register {
my ( $self, $app, $conf ) = @_;
my $r = $app->routes;
'Dispatcher#call',
service => $svc,
namespace => 'MojoX::JSON::RPC',
exists $conf->{exception_handler}
? ( exception_handler =>
ious::Plugin::JsonRpcDispatcher - Plugin to allow Mojolicious to act as a JSON-RPC server.
=head1 SYNOPSIS
# lib/your-application.pm
use base 'Mojolicious';
use MojoX::JSON::RPC::Servic
iteScrapper;
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use Mojo::DOM;
use JSON;
use Encode qw(encode);
our $VERSION = '1.00';
sub new {
my $class = shift;
my $self =
ormater;
use 5.010;
use strict;
use warnings;
use HTML::Entities qw(encode_entities);
use JSON qw(from_json);
our $VERSION = '0.51';
my %plugins = (
toc => \&_handle_toc,
image => \&_h
tr =~ m(\A\s*[\{\[]) ) {
$paramstr = '['.$paramstr.']';
}
my $params = eval {
from_json( $paramstr, { utf8 => 1 })
} or do print STDERR "Error Parsing params: $paramstr ==> $@\n";
params>, when existing, must be a list of valid JSON elements. If it is
a JSON object ({}), it will be used, otherwise it will be transformed
into a JSON array (by adding '[' in the begining and ']' o
0.10";
use threads;
use Thread::Queue;
use Scalar::Util qw(weaken);
use Mojo::IOLoop;
use Mojo::JSON;
use Mojo::Promise;
use Mojo::Util qw(monkey_patch);
use YAML::Any qw(Dump);
BEGIN {
## no c
has deserialize => sub { \&Mojo::JSON::decode_json };
has ioloop => sub { Mojo::IOLoop->singleton }, weak => 1;
has serialize => sub { \&Mojo::JSON::encode_json };
sub exit_code { shift->{exit
ista::Scrap::DevtoScrapper;
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Encode qw(encode);
our $VERSION = '1.00';
sub new {
my $class = shift;
my $self =
r);
my @posts = ();
if ( $response->is_success ) {
my $responseContent = decode_json $response->decoded_content;
my @children = @{$responseContent};
foreach (
e DTA::CAB::Analyzer::Common;
use DTA::CAB::Analyzer::Dict::Json;
use DTA::CAB::Analyzer::Dict::JsonDB;
use DTA::CAB::Analyzer::Dict::JsonCDB;
use DTA::CAB::Analyzer::TextPhonetic;
use DTA::CAB::Ana
fault='/xmlrpc')
##
## format => $formatName, ##-- default query I/O format (default='json')
## #encoding => $encoding, ##-- query encoding (always utf8)
## cacheGet => $bo
rpcpath => '/xmlrpc',
##
cacheGet=>1,
cacheSet=>1,
##
format => 'json',
##
##-- low-level stuff
ua => undef,
uargs => {},
##
##-- u
rpc')
format => $fmtName, ##-- DTA::CAB::Format short name for transfer (default='json')
cacheGet => $bool, ##-- allow cached response from server? (default=1)
ca
ghlight-matches=elements|attributes|both|none
stylesheet=<path>
method=xml|xhtml|json|text
encoding=<string>
jsonp=myFunctionName
media-type=<string>
doctype-public=<string>
doctype-system=<str
::JSON qw(decode_json encode_json);
#~ use Encode qw(encode decode);
use Mojo::Loader;
use JSON::PP;
my $JSON = JSON::PP->new->utf8(0);
our @EXPORT_OK = qw(json_enc json_dec load_class);
sub json_e
nc {
#~ decode('utf-8', encode_json(shift));
$JSON->encode(shift);
}
sub json_dec {
#~ decode_json(encode('utf-8', shift));
$JSON->decode(shift);
}
sub load_class {
my $class;
if (@_
ls qw(error_message warning_message);
use Moose::Role;
use WWW::Trello::Lite;
use JSON::XS qw(encode_json decode_json);
use Path::Class;
has 'trello' => (
is => 'rw',
isa
$in =~ s/\s+//;
unless ( $in =~ /^n/i ) {
my $f = file($file);
my $old = JSON::XS->new->utf8->relaxed->decode(
scalar $f->slurp( iomode => '<:encoding(UTF-8)' ) );
llo}{$k} = $v;
}
$f->spew(
iomode => '>:encoding(UTF-8)',
JSON::XS->new->utf8->pretty->encode($old)
);
}
}
sub _trello_fetch_card {
my ( $self,
th;
use Mojo::Base 'Mojolicious::Controller';
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);#load_class
use Hash::Merge qw( merge );
use Digest::MD5 qw(md5_hex);
my ($Init);
has
serinfo',
profile_query => sub {
my ($c, $auth, ) = @_;
{
alt => 'json',
access_token => $auth->{access_token},
};
},
profile_avatar =>'pi
info",
profile_query => sub {
my ($c, $auth, ) = @_;
{
format => 'json',
oauth_token=> $auth->{access_token},
};
},
# "default_avatar_id":
-base;#'Mojolicious::Plugin::Authentication'
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);
has [qw(session_key stash_key app plugin model)];
sub new {
state $self = shift->S
if ( $guest && $guest->{id}) {
my $json = $guest->{data} && json_dec(delete $guest->{data});
@$guest{ keys %$json } = values %$json
if $json;
$self->app->log->debug("Succes
aders->to_hash(1);
$data->{IP} = $c->tx->remote_address;
my $guest = $self->model->store(json_enc($data));
$c->session($self->session_key => $guest->{id});
$c->stash($self->stash_key
;
my $json = $c->req->json;
my ($cookie) = ($json && $json->{cookie})
|| $c->vars('cookie');
unless ($cookie) {
return $c->render(json=>{error=>"No cookie"})
if $json;
|| {error=>"none profile by given cookie [$cookie]"}} };
return $c->render(json=>{profile=>$profile})
if $json;
return $c->render(text=>"Success signed by cookie\n".$c->dumper($profile)
mats for
L<document data|/"Data Model">,
including
L<"CSV"|DTA::CAB::Format::CSV>,
L<"JSON"|DTA::CAB::Format::JSON>,
L<"Raw"|DTA::CAB::Format::Raw>,
L<"Text"|DTA::CAB::Format::Text>,
L<"TT"|DTA::CAB::
<Log::Any> messages
=head1 SYNOPSIS
use JSON::MaybeUTF8 qw(:v1);
use Log::Any::Adapter qw(Coderef) => sub {
my ($data) = @_;
STDERR->print(encode_json_utf8($data) . "\n");
};
=head1 DESCRIPT
-base;#'Mojolicious::Plugin::Authentication'
use Mojolicious::Plugin::RoutesAuthDBI::Util qw(json_enc json_dec);
use Mojo::Util qw(decode url_unescape);
#~ use constant PKG => __PACKAGE__;
has [qw
nth or quarter. This is very
helpful for mapping tasks to maintainance contracts.
cat .tracker.json
"billing":{
"required":false,
"default": "strftime",
"strftime": "%Y/Q%{quart
ies&format=json&props=sitelinks&ids=Q19675&sitefilter=enwiki");
my $id = "Q100148272";
$url->query({ ids => $id });
$tx = $ua->get($url);
my $json = $tx->res->json();
print dumper $json;
print du
mper $tx->res->json('//title');
my $u = Weirdo->new($json);
print dumper $u->get('$.entities.Q100148272.sitelinks.enwiki.title');
print dumper $u->get('..title');