ID. Returns any new stemmata that were created.
=begin testing
use Text::Tradition;
use JSON qw/ from_json /;
my $t = Text::Tradition->new(
'name' => 'Stemweb test',
'input' => 'Self',
mweb_jobid' => '4',
);
is( $t->stemma_count, 0, "No stemmas added yet" );
my $answer = from_json( '{"status": 0, "job_id": "4", "algorithm": "RHM", "format": "newick", "start_time": "2013-10-26
asure
use Encode qw/ decode_utf8 encode_utf8 /;
use Exporter 'import';
use Graph;
use JSON qw/ to_json decode_json /;
use LWP::UserAgent;
use Set::Scalar;
use Text::Tradition::Analysis::Result;
use Te
;
my $json = JSON->new->allow_blessed->convert_blessed->utf8->encode(
[ values %problems ] );
# Send it off and get the result
# print STDERR "Sending request: " . decode_utf8( $json ) . "\n
->{solver_url}, 'Content-Type' => 'application/json',
'Content' => $json );
my $answer;
if( $resp->is_success ) {
$answer = decode_json( $resp->content );
throw( "Unexpected answ
es
use base qw(Labyrinth::Plugin::Base);
use Labyrinth::Support;
use Labyrinth::Variables;
use JSON;
use WWW::Mechanize;
#--------------------------------------------------------------------------
;
return if($@ || !$mech->success() || !$mech->content());
my $json = $mech->content();
my $data = decode_json($json);
return unless($data);
$tvars{sponsor} = {
title =>
code_utf8 );
use File::Temp;
use File::Which;
use Graph;
use IPC::Run qw( run binary );
use JSON qw/ to_json /;
use Text::CSV;
use Text::Tradition::Collation::Data;
use Text::Tradition::Collation::Rea
);
}
}
}
=head2 as_adjacency_list
Returns a JSON structure that represents the collation sequence graph.
=begin testing
use JSON qw/ from_json /;
use Text::Tradition;
my $t = Text::Tradition-
tical' } );
# Create an adjacency list of the whole thing; test the output.
my $adj_whole = from_json( $c->as_adjacency_list() );
is( scalar @$adj_whole, scalar $c->readings(),
"Same number of node
} @succ;
}
## Utility methods
sub _stringify {
my $self = shift;
return $self->id;
}
sub TO_JSON {
my $self = shift;
return $self->text;
}
sub throw {
Text::Tradition::Error->throw(
'iden
ns qw(catfile tmpdir);
use Mojo::Util qw(slurp spurt steady_time);
use Mojo::JSON qw(encode_json decode_json);
has initialized => sub { 0 };
has qw(file);
use constant DEBUG =>
) {
spurt(encode_json($hash), $state->file);
$state->_unlock($fh);
return $hash;
}
elsif (-f $state->file) {
my $ret = decode_json(slurp($state->file));
use File::Spec::Functions qw(catfile tmpdir);
use IO::Handle;
use Mojo::JSON qw(encode_json decode_json);
use POSIX qw(:sys_wait_h);
use Time::HiRes qw(usleep);
use Mojo::Util
}
sub inflated_rw_type { 'List::Objects::WithUtils::Hash::Inflated::RW' }
=for Pod::Coverage TO_JSON TO_ZPL damn type
=cut
sub is_mutable { 1 }
sub is_immutable { ! $_[0]->is_mutable }
sub type
$_[0]
}
sub export { %{ $_[0] } }
sub unbless { +{ %{ $_[0] } } }
{ no warnings 'once';
*TO_JSON = *unbless;
*TO_ZPL = *unbless;
*damn = *unbless;
}
sub clear { %{ $_[0] } = (); $_
e methods documented below, these objects provide a
C<TO_JSON> method exporting a plain HASH-type reference for convenience when
feeding L<JSON::Tiny> or similar, as well as a C<TO_ZPL> method for
com
) ? $coerced
: Carp::confess "I should be unreachable!"
} @vals
}
=for Pod::Coverage TO_JSON TO_ZPL damn type
=cut
sub type {
# array() has an empty ->type
}
sub new { bless [ @_[1 .. $
module( $cls->inflated_type );
$cls->inflated_type->new(@$self)
}
{ no warnings 'once';
*TO_JSON = *unbless;
*TO_ZPL = *unbless;
*damn = *unbless;
}
sub unbless { [ @{ $_[0] } ] }
e methods documented below, these objects provide a
C<TO_JSON> method exporting a plain ARRAY-type reference for convenience when
feeding L<JSON::Tiny> or similar, as well as a C<TO_ZPL> method for
co
();
use CPAN::Testers::Report 1.999001 ();
use File::Glob ();
use JSON::MaybeXS;
use Metabase::User::Profile 0.016 ();
use Metabase::User::Secret 0.016 ();
use Met
:confess __PACKAGE__. ": could not read ID file '$self->{id_file}'"
. "\n$!";
my $data = JSON::MaybeXS->new(ascii => 1)->decode( do { local $/; <$fh> } );
my $profile = eval { Metabase::Us
=> 'http://metabase.example.com:3000/',
id_file => '/home/jdoe/.metabase/metabase_id.json',
],
);
# use space-separated in a CPAN::Reporter config.ini
transport = Met
package Qiniu::Auth;
use strict;
use Qiniu::Util qw/encode_json safe_b64_encode hmac_sha1/;
use Moo;
our $VERSION = '0.05';
use constant DEFAULT_AUTH_SECONDS => 3600;
has [qw/access_key secret_key
map { $_ => $Fields->{$_} }
grep { $Fields->{$_} } keys %$Fields;
return encode_json(\%args)
}
sub private_url {
my $self = shift;
my $download_url = shift;
my $e = tim
The Pushover API client implementation
# pragmas
use 5.10.0;
# imports
use Moo;
use Carp;
use JSON;
use LWP::UserAgent;
# version
our $VERSION = 0.021;
# accessors
has token => (is => 'rw');
ha
g data
my $res = $self->_ua->post(
'https://api.pushover.net/1/messages.json', $args
);
return JSON::decode_json($res->decoded_content)
}
sub _auth_validation {
my $self = shift;
# au
nt>'
);
Method C<message> send a notification for an specificated user and returns
decoded C<JSON> from API http response.
Official message API docs at L<https://pushover.net/api#messages>
=h
t_t type);
uintptr_t ngx_escape_html(u_char *dst, u_char *src, size_t size);
uintptr_t ngx_escape_json(u_char *dst, u_char *src, size_t size);
typedef struct {
ngx_rbtree_node_t node;
efined'?'application/json':'application/x-www-form-urlencoded';
\$.ajax({
type: methodType,
url: url,
headers: {
Accept : 'application/json; charset=utf-8',
lass=\"form-control\">
<option selected=\"selected\">text/html</option>
<option>application/json</option>
<option>text\/yaml</option>
<option>text/plain</option>
</select>
<button type=\
lass=\"form-control\">
<option selected=\"selected\">text/html</option>
<option>application/json</option>
<option>text/yaml</option>
<option>text/plain</option>
</select>
<label class=\"
package Cltest::ChangeInfo;
use 5.018;
use warnings;
use JSON::PP;
use Cltest::PatchsetBuildResult;
use Cltest::Utils;
# return hash
sub get_change_detail
{
my $ua = Cltest::Utils::get_ua();
my $c
$resp = $ua->get($url);
if ($resp->is_success ){
$_ = $resp->decoded_content;
return decode_json( substr( $_, index ($_, "\n") + 1) );
}
else {
die "get_change_detail : url = $url ",$resp->s
# AJAX communication
require JSON;
$hta->show(
AJAX => sub {
my($request) = @_;
print JSON::encode_json($request);
my $ok = int(rand(
(JSON::decode_json($rq_raw));
my $reply = "HTTP/1.1 200 OK\n";
$reply .= "Content-Type: text/html; charset=utf-8\n\n";
$reply .= JSON::encode_json
or die "Win32::Process is needed for ajax fuctionality\n";
eval { require JSON }
or die "JSON is needed for ajax fuctionality\n";
Win32::Process::Create(
m
'import';
use Mojo::JSON qw(decode_json encode_json);
use Digest::SHA qw(hmac_sha1);
use MIME::Base64 qw(decode_base64 encode_base64);
our @EXPORT_OK = ( qw(decode_json encode_json safe_b64_encode enc
token => $token,
file => {
file => $local_file
}}
)->res->json;
}
sub upload_data {
my ($self, $token, $data, $key ) = @_;
my $ua = Mojo::UserAgent->ne
n,
file => {
filename => $key,
content => $data,
}}
)->res->json;
}
sub upload_stream {
my ($self, $token, $local_file, $key, $mimetype) = @_;
my $ua =
on' => 'UpToken ' . $token,
},
$bput_data)->res->json;
$ctx[$block_nu] = $result->{ctx};
}
}
my $mkfile_api = $self->upapi
ss=\"path\">$path</span>
</div>
<ul class=\"format\">
<li><a href=\"?format=application/json\">json</a></li>
<li><a href=\"?format=text/yaml\">yaml</a></li>
<li><a href=\"?format=text/pla
e HTTP::Exception '4XX';
use JSON::XS;
use YAML::Syck;
my $Mime_types;
$YAML::Syck::ImplicitUnicode = 1;
$Mime_types = {
'application/json' => sub { &decode_json($_[1]) },
'text/yaml'
e::FormatOutput
=back
=head1 CONSTANTS
=head2 DEFAULT MIME TYPES
=over 4
=item * application/json
=item * text/yaml
=item * text/plain
=item * application/x-www-form-urlencoded
As default t
:Storage::CHI::VERSION = '0.004';
use Mojo::Base qw/Mojolicious::Sessions::ThreeS::Storage/;
use JSON;
=head1 NAME
Mojolicious::Sessions::ThreeS::Storage::CHI - An adapter to store sessions in a CH
S->new({ storage => $storage , state => ... } );
Note that you WILL have to depend on CHI and on JSON in your application to use this storage.
This distribution does not add these to the runtime dep
43200;
has 'chi';
has 'json' => sub{
my $json = JSON->new();
$json->ascii( 1 );
# Encode stuff in ascii so there is no risk
# of bad decoding.
return $json;
};
=head1 METHODS
=h