::Bilingual::Reader;
# ABSTRACT: A book reader class
use Mojo::Base -base;
use Mojo::JSON qw(decode_json encode_json);
use Book::Bilingual;
use Book::Bilingual::File;
use Path::Tiny qw/path/;
use Carp
ook_json {
my ($self) = @_;
my $Book_json = [];
foreach my $ch_idx (0..$self->book->chapter_count-1) {
my $chapter = $self->book->chapter_at($ch_idx);
my $Chapter_json =
et_json = [];
foreach my $dline_idx (0..$dlineset->dline_count-1) {
my $dline = $dlineset->dline_at($dline_idx);
my $Dline_json = { # Create Dline JSON ob
elf->ua->post_form(@$req);
$self->res($res);
}
sub _json
{
my(undef, $json) = @_;
require JSON::MaybeXS;
JSON::MaybeXS::decode_json($json);
}
sub _today
{
my($year,$month,$day) = (localtim
= @_;
my $res = $self->_post('CmdW', { cmd => 'UserInfoW'});
$res->{status} == 200 ? $self->_json($res->{content}) : ();
}
sub kid_summary
{
my($self, $kid_id) = @_;
Carp::croak("Usage: \$d
dW', { cmd => 'KidGetSummary', Kid => $kid_id, pdt => $date });
$res->{status} == 200 ? $self->_json($res->{content}) : ();
}
sub kid_status
{
my($self, $kid_id) = @_;
Carp::croak("Usage: \$dc
package Mojolicious::Plugin::FormFieldsFromJSON;
use Mojo::Base 'Mojolicious::Plugin';
# ABSTRACT: create form fields based on a definition in a JSON file
our $VERSION = '1.03';
use Carp;
use File:
sset::File;
use Mojo::Collection;
use Mojo::ByteStream;
use Mojo::File qw(path);
use Mojo::JSON qw(decode_json);
use Mojolicious ();
has dir => sub { ["."] };
sub register {
my ( $self, $app, $
{
next FILE if $file !~ m{\.json\z};
my $filename = basename $file;
$filename =~ s{\.json\z}{};
$configfiles{$filenam
- Initial release
__[ .gitignore ]__
/{{ $dist->name }}-*
/.build
/_build*
/Build
MYMETA.*
!META.json
/.prove
__[ cpanfile ]__
requires 'perl', '5.014000';
requires 'Moose::Role', '2.0000';
requires
::GatherDir]
exclude_filename = META.json
exclude_filename = LICENSE
exclude_filename = README.md
exclude_filename = Build.PL
[CopyFilesFromBuild]
copy = META.json
copy = LICENSE
copy = Build.PL
[Re
Documentation, Meta
[Git::Check]
allow_dirty = dist.ini
allow_dirty = Changes
allow_dirty = META.json
allow_dirty = README.md
allow_dirty = Build.PL
[GithubMeta]
issues = 1
[ReadmeAnyFromPod]
filen
->stash(user_id=>'administrator');
return 1
}
if (($c->stash('format')||'x') eq 'json') {
$c->fail;
return;
}
$c->add_flash(errors => 'Please sign in first us
package Web::Request::Role::JWT;
# ABSTRACT: Accessors for JSON Web Token (JWT) stored in psgix
our $VERSION = '1.003'; # VERSION
use 5.010;
use Moose::Role;
use HTTP::Throwable::Factory qw(http_th
} );
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Web::Request::Role::JWT - Accessors for JSON Web Token (JWT) stored in psgix
=head1 VERSION
version 1.003
=head1 SYNOPSIS
# Create a req
$sub );
return $self->json_response( $data );
}
=head1 DESCRIPTION
C<Web::Request::Role::JWT> provides a few accessor and helper methods
that make accessing JSON Web Tokens (JWT) stored in
load_response( 'text/csv', $data, 'your_export.csv' );
=head1 DESCRIPTION
C<Web::Request::Role::JSON> provides a few methods that make generating HTTP responses easier when using L<Web::Request>.
P
say $c->http_request->uri;
# output:
https://api.twitter.com/1.1/statuses/home_timeline.json?trim_user=true
=head1 DESCRIPTION
Twitter has a strange concept of boolean values. Usually, the
'README',
'README.pod',
'Makefile.PL',
'Build.PL',
'META.json'
],
}
],
[
ReadmeAnyFromPod => {
location => 'root',
plugin eq 'makemaker'
? ('Makefile.PL')
: ()
),
'META.json',
],
}
],
($install_plugin eq 'modulebuild_optionalxs'
? ([ 'ModuleBu
stall_plugin eq 'mbtiny'
? ([ 'ModuleBuildTiny' => { } ])
: ()
),
[
MetaJSON => { }
],
# [ CheckChangesHasContent => { } ],
);
if ($nextversion eq 'git') {
pu
Mojolicious::Controller';
# 'shipped' is a special stash slot for passing serialisable things to json or templates.
# Other stash slots can be complex objects for use by templates.
sub ok {
my $
$error = "tables activity unauthorised";
$c->fail($error) if (($c->stash('format')||'x') eq 'json');
$c->add_flash(errors=>$error);
$c->redirect_to('/');
return;
}
# more fine-graine
data => \@data,
};
if (($c->stash('format')||'data') eq 'json') {
$c->render( json => $bundle );
return;
}
$c->render(data => $c->dumper($bundle));
}
Response> object for the API call.
#pod
#pod =method twitter_error
#pod
#pod Returns the inflated JSON error response from Twitter (if any).
#pod
#pod =cut
has context => (
is => 'ro',
ring representation of the exception. If Twitter
#pod returned error information in the form of a JSON body, it is mined for error
#pod text. Otherwise, the HTTP response status line is used. The stac
eturns the L<HTTP::Response> object for the API call.
=head2 twitter_error
Returns the inflated JSON error response from Twitter (if any).
=head2 stack_trace
Returns a L<Devel::StackTrace> object
, $to_json ) = @_;
croak 'expected a single hashref argument'
unless @_ == 2 && is_hashref($_[1]);
$self->request(post => 'media/metadata/create', {
-to_json => $to_json,
tion {
my ( $self, $to_json ) = @_;
croak 'unexpected extra args' if @_ > 2;
$self->request(post => 'collections/entries/curate', {
-to_json => $to_json,
});
}
#pod =method d
my $args = shift // {};
$self->request(post => 'direct_messages/events/new', {
-to_json => { event => $event }, %$args
});
}
#pod =method invalidate_access_token([ \%args ])
#pod
#
gest::SHA;
use Encode qw/encode_utf8/;
use HTTP::Request;
use HTTP::Request::Common qw/POST/;
use JSON::MaybeXS ();
use Module::Runtime qw/use_module/;
use Ref::Util qw/is_arrayref is_ref/;
use Try::T
',
default => sub { '1.1' },
);
has api_ext => (
is => 'ro',
default => sub { '.json' },
);
has [ qw/consumer_key consumer_secret/ ] => (
is => 'ro',
required => 1,
);
},
);
has json_parser => (
is => 'ro',
lazy => 1,
default => sub { JSON::MaybeXS->new(utf8 => 1) },
handles => {
from_json => 'decode',
to_json => 'encode
|= []}, $val;
});
$app->helper(shipped => sub {
# special stash slot for sending json-able structs to js;
# get/set logic here cloned from Mojo::Util::_stash.
my $c =
edit del nuke navigate/);
my @crud_posts = (qw/save/);
my $fmts = [format=>[qw/html json/]];
for ($r->under('tables') ->to('auth#ok' )) {
for ($_-
uments
use v5.16.0;
use Moo;
with qw(Search::Typesense::Role::Request);
use Mojo::JSON qw(decode_json encode_json);
use Search::Typesense::Types qw(
ArrayRef
Enum
HashRef
InstanceOf
NonEm
, 'export' ],
return_transaction => 1
) or return; # 404
return [ map { decode_json($_) } split /\n/ => $tx->res->body ];
}
sub import {
my $self = shift;
state $check = c
my ( $collection, $action, $documents ) = $check->(@_);
my $body = join "\n" => map { encode_json($_) } @$documents;
my $tx = $self->_POST(
path => [ 'collections', $collection, 'do
h engine
use v5.16.0;
use Moo;
with 'Search::Typesense::Role::Request';
use Mojo::JSON qw(decode_json encode_json);
use Mojo::UserAgent;
use Mojo::URL;
use Carp qw(croak);
use Search::Typesense::D
@_;
$tx->req->headers->header(
'Content-Type' => 'application/json' )
->header( 'X-TYPESENSE-API-KEY' => $key );
}
);
( json => $body ) : $body;
return $self->_handle_request( \%arg_for, \@args );
}
sub _PATCH {
my ( $self, %arg_for ) = @_;
my $body = $arg_for{body};
my @args = ref $body ? ( json =>
rl' failed: $message. $body");
}
return $arg_for->{return_transaction} ? $tx : $tx->res->json;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Search::Typesense::Role::Request - No user-s
,
query => $query,
return_transaction => 1,
) or return;
return $tx->res->json;
}
sub get {
my ( $self, $collection ) = @_;
state $check = compile(Str);
my @collec
$field->{facet} ) {
$field->{facet}
= $field->{facet} ? Mojo::JSON->true : Mojo::JSON->false;
}
}
return $self->_POST(
path => ['collections'],
arnings qw(all);
use Carp qw(carp confess);
use Digest::SHA;
use Encode;
use HTTP::Response;
use JSON;
use Moo;
use MooX::Types::MooseLike::Base qw(
AnyOf
Bool
CodeRef
HashRef
Ins
al);
our $VERSION = '0.049'; # VERSION
has json => (
is => 'ro',
isa => InstanceOf['JSON'],
default => sub { JSON->new->utf8->allow_blessed->convert_blessed }
if ($key == Net::Curl::Easy::CURLOPT_POSTFIELDS) {
my $is_json = 0;
($val, $is_json) = $self->_setopt_postfields($val);
$orig->($self =>
tablish /.well-known/host-meta route
my $route = $app->routes->any( $WK_PATH => [format => [qw!json xml jrd xrd!]] );
# Define endpoint
$route->endpoint('host-meta');
# Set route callb