:Zilla::Role::BeforeRelease';
use Encode qw(encode_utf8);
use LWP::UserAgent;
use version ();
use JSON::PP;
# Lots of this is cargo-culted from DZP::CheckPrereqsIndexed
sub before_release {
my (
->get("http://cpanidx.org/cpanidx/json/mod/$pkg");
if ($res->is_success) {
my $yaml_octets = encode_utf8($res->decoded_content);
my $payload = JSON::PP->new->decode($yaml_octets);
verters
=head3 L<DataFlow::Proc::MessagePack> 1.112100
No tests yet!!
=head3 L<DataFlow::Proc::JSON> 1.112100
No tests yet!!
=head3 L<DataFlow::Proc::YAML> 1.112100
No tests yet!!
=head3 L<Data
use 5.10.0;
use Moose;
use Neo4j::Relationship;
use Neo4j::REST::Client;
use Data::Printer;
use JSON;
has 'id' => (
isa => 'Num',
required => 0,
is => 'rw',
);
has 'client'
for ( $self->client->status ) {
when ('200') {
$self->_endpoints( decode_json( $self->client->content ) );
$self->_self_endpoint( $self->_endpoints->{self} );
t('node'),
encode_json( $self->data ) );
for ( $self->client->status ) {
when ('201') {
# all good
$self->_endpoints( decode_json( $self->client->content
esult;
use Google::Search::Error;
use LWP::UserAgent;
require HTTP::Request::Common;
use JSON;
my $json = JSON->new;
BEGIN {
use vars qw/ $Base %Service2URI /;
$Base = 'http://ajax.googleapi
"Malformed content: $content" unless $content =~ s/^.*?\(\[(.*)\]\)$/[$1]/g;
my $data = $json->decode( $content );
croak "Malformed content: $content" unless ref $data eq 'ARRAY' && $
package Neo4j::REST::Client;
use 5.10.0;
use Moose;
use Data::Printer;
use REST::Client;
use JSON;
use Try::Tiny;
has 'root_URL' => (
required => 1,
isa => 'Str',
is => 'rw',
:Client->new;
$client->addHeader( 'Accept', 'application/json' );
$client->addHeader( 'Content-Type', 'application/json' );
return $client;
}
has 'root_endpoints' => (
isa =
);
$self->GET($self->root_URL);
if($self->status eq '200') {
my $root_endpoints = decode_json($self->content);
# FIX for missing relationships endpoint on the API
$root_endpoints->{re
ict;
use warnings;
use Moose;
use Neo4j::REST::Client;
use Neo4j::Node;
use Data::Printer;
use JSON;
has 'id' => (
isa => 'Num',
required => 0,
is => 'rw',
);
has 'client'
for ( $self->client->status ) {
when ('200') {
$self->_endpoints( decode_json( $self->client->content ) );
$self->_self_endpoint( $self->_endpoints->{self} );
;
$self->client->POST($url, encode_json( $payload) );
for ( $self->client->status ) {
when ('201') {
$self->_endpoints( decode_json( $self->client->content ) );
Log::Message::Structured::Component::Hostname
Log::Message::Structured::Stringify::AsJSON
/;
has foo => ( is => 'ro', required => 1 );
... elsewhere ...
use aliased 'My
either pass around in your application, log in a traditional
manor as a log line, or serialize to JSON or YAML for transmission over the
network.
=head1 COMPONENTS
The consuming class can include co
m L<Log::Message::Structured::Stringify::Sprintf>
=item L<Log::Message::Structured::Stringify::AsJSON>
=item L<Log::Message::Structured::Stringify::AsYAML>
=back
=head1 AUTHOR AND COPYRIGHT
Tomas
e;
use JSON qw//;
use Log::Any qw//;
use namespace::autoclean;
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
if (@_ == 1 && !ref $_[0]) {
my $note = JSON->new->
, JSON->backend);
my $json = JSON->new;
$json->allow_blessed;
$json->convert_blessed;
my $serialised_note = $json->utf8->encode($self);
return $serialised_note;
}
method TO_JSON
package Log::Message::Structured::Stringify::AsJSON;
use Moose::Role;
use namespace::autoclean;
use JSON::Any;
use utf8 ();
requires 'as_hash';
around 'as_string' => sub {
my $orig = shift;
as_hash;
my $json = JSON::Any->objToJson( $hashref );
utf8::decode($json) if !utf8::is_utf8($json) and utf8::valid($json); # if it's valid utf8 mark it as such
return $json;
};
1;
__END
__
=pod
=head1 NAME
Log::Message::Structured::Stringify::AsJSON - JSON log lines
=head1 SYNOPSIS
package MyLogEvent;
use Moose;
use namespace::autoclean;
with qw/
Log::Me
ge Neo4j::Index;
use strict;
use warnings;
use 5.10.0;
use Moose;
use Neo4j::REST::Client;
use JSON;
has 'client' => (
required => 1,
isa => 'Neo4j::REST::Client',
is => 'r
number of purposes, but the
principle intention is to make MARC data amenable to serializing into
JSON, YAML, etc. Field and subfield order is preserved. Multiple
instances of either are also allowed.
ed by Frederic Demians' MARC::Moose::Formater::JSON.
Format inspired by http://dilettantes.code4lib.org/blog/2010/09/a-proposal-to-serialize-marc-in-json
=head1 AUTHOR
Clay Fouts <cfouts@khephera.n
y $length = do { no warnings; use bytes; length $http_body; };
$r->content_type('application/json');
$r->headers_out->{'Content-Length'} = $length;
$r->print($http_body);
return Apa
CIES
Apache::ExtDirect is dependent on the following modules:
L<mod_perl2>, L<RPC::ExtDirect>, L<JSON>, L<Attribute::Handlers>.
=head1 SEE ALSO
For more information on core functionality see L<RPC:
>. The default serialization method is L<JSON>,
though one can specify any serialization format you want. L<YAML> and L<Storable> are
viable alternatives.
JSON was chosen as the default serialization
on ephemeral - Store it compactly
return to_json({%$self}, { pretty => 0 });
}
# Default Deserialize method
sub _deserialize {
my ($self, $json) = @_;
my $settings = setting('session_opt
efined $settings->{deserializer}) {
return $settings->{deserializer}->($json);
}
return from_json($json);
}
=head1 SEE ALSO
L<Dancer>, L<Dancer::Session>, L<Plack::Session::Store:
;
}
##
#
#
sub toJson {
my ($self, $rel) = @_;
$rel //= "NT";
$rel = [$rel] unless ref($rel);
my $top = $self->topName;
$self->_toJson($top, $rel);
}
sub _toJson {
my ($self,
json = "{ \"data\": \"$term\", \"attr\":{id:\"$term\"}";
if (keys %$h) {
$json .= ", \"children\": [";
$json .= join(", ", map { $self->_toJson($_, $rel) } keys %$h);
$json
.= "]"
}
$json .= "}";
}
###
#
#
sub _tc_aux {
my ($self,$term,$vis,@relat) = @_;
$term = $self->getdefinition($term);
my %r = ( $term => 1 );
for ($self->terms($term,@relat)) {
Direct plugin for Dancer
use strict;
use warnings;
use Dancer ':syntax';
use Dancer::Plugin;
use JSON ();
# The best Ext Direct docs out there are provided by the Django implementation:
# https://gi
Handler => JSON::true) : (),
};
}
}
content_type 'text/javascript';
sprintf "Ext.Direct.addProvider(%s);\n",
to_json {
Type|Upload)$/, keys %{¶ms} } ],
};
} else {
$requests = from_json(request->body)
or return status 400;
# wrap the request
ing" };
$columns{last_name} = {operator => "ILIKE", type => "string" };
$connector->jsonForGrid( $table, $primary_key, \%columns );
$connector->xmlForGrid( $table, $primary_key,
ACT
=cut
# ABSTRACT: DHTMLX Perl connector
use strict;
use warnings 'all';
use JSON;
use XML::Mini::Document;
use Locale::Currency::Format;
use vars qw (
$VERS
rency = $self->{currency};
}
bless $self, $class;
return $self;
}
sub jsonForGrid
{
my($self, $table, $primary_key, $columns, $nRegPag, $isSmartRendering, $iden
ABSTRACT: Basics tasks on DHTMLX Perl module
use strict;
use warnings 'all';
use DBI;
use JSON;
use HTML::Entities;
use POSIX qw(locale_h strtod setlocale LC_MONETARY LC_CTYPE);
# config
# prints
{
"response":"foo is undefined",
"status":"error"
}
Prints a JSON string with errors details and exit the application;
=cut
sub error
{
my($self, $strErro
%resposta = (
status => "error",
response => $strErro,
);
my $json = \%resposta;
print to_json($json, { utf8 => 1 });
exit;
}
=head2 Post
my $value_from_post =
package Bio::PhyloTastic::TNRS;
use strict;
use warnings;
use JSON;
use URI::Escape;
use Data::Dumper;
use LWP::UserAgent;
use Bio::Phylo::IO 'parse';
use Bio::Phylo::Util::CONSTANT ':objecttypes';
us
s is a redirect
my $obj = decode_json($result);
# start polling
while(1) {
sleep $wait;
my $result = _fetch_url($obj->{'uri'},'get');
my $obj = decode_json($result);
if ( $obj->{'names'}
est::SHA qw/sha256_hex/;
use Encode qw/encode_utf8/;
use Google::Directions::Response;
use JSON qw/decode_json/;
use LWP::UserAgent;
use Moose;
use MooseX::Params::Validate;
use MooseX::WithCache;
use
e_url> Default: C<https://maps.googleapis.com>
=item I<api_path> Default: C</maps/api/directions/json>
=item I<limit_path_length> limit is documented at 2048, but errors occur at 2047.. Default: 204
has 'api_path' => ( is => 'ro', isa => 'Str',
default => '/maps/api/directions/json' );
has 'limit_path_length' => ( is => 'ro', isa => 'Int', default => 2046 );
# Create a L