"github/gollum",
mode => "gfm",
},
);
# Note that response is NOT in JSON, so ->content will die
my $html = $response->raw_content;
=head1 AUTHOR
Johannes Plunien <p
m::VERSION = '0.01';
}
use Moose;
use IO::Handle qw(autoflush);
use IO::File;
use JSON::XS qw(decode_json encode_json);
use Log::Log4perl;
use IO::Storm::Tuple;
# ABSTRACT: Perl support for Twitter'
($self) = @_;
return decode_json($self->read_string_message);
}
sub send_message_to_parent {
my ($self, $href) = @_;
$self->send_to_parent(encode_json($href));
}
sub send_to_parent
Read a message from the ShellBolt and decode it from JSON.
=head2 send_message_to_parent
Sent a message to the ShellBolt, encoding it as JSON.
=head2 send_to_parent
Send a message to the ShellBo
roducer;
use strict;
use warnings;
use base qw/MyApp::ControllerBase::REST/;
use JSON::XS;
__PACKAGE__->config(
action => { setup => {
ject}->get_columns;
}
}
1;
__compclass__
package [% class %];
use strict;
use warnings;
use JSON::XS;
use parent qw/[% app %]::ControllerBase::REST/;
__PACKAGE__->config(
# Define parent c
use Data::Encoder;
my $encoder = Data::Encoder->load('JSON');
my $json = $encoder->encode(['foo']);
my $data = $encoder->decode($json);
=head1 DESCRIPTION
Data::Encoder is generic interface
sary, and create new instance of using the given arguments.
my $encoder = Data::Encoder->load('JSON', +{ utf8 => 1, pretty => 1 });
my $encoder = Data::Encoder->load('+My::Encoder', +{ option
a spout tuple message.
:param tup: the tuple to send to Storm. Should contain only
JSON-serializable data.
:type tup: list
:param tup_id: the ID for the tuple. Leave this blank for an
$access_token = $token_object->valid_access_token();
=cut
use Moose::Util::TypeConstraints;
use JSON;
use Carp;
use URI::Escape;
use YAML qw/LoadFile DumpFile Dump/;
use MooseX::Types::URI qw(Uri Fi
%s/%s", $response->code, $response->title );
}
my $obj = eval{local $SIG{__DIE__}; decode_json($response->decoded_content)} || {};
if( not $obj->{access_token} ){
croak( "No access
ror_uri state/) {
$hash{$_} = $self->{$_} if defined $self->{$_};
}
return encode_json(\%hash);
}
=head2 sync_with_store
Sync with the store file.
First reads out the current data fr
Id$
package JavaScript::JSLint;
use strict;
use warnings;
use Carp;
use JavaScript;
use JSON qw(encode_json);
use base qw( Exporter );
our @EXPORT = qw( jslint );
our @EXPORT_OK = qw( jslint jsli
json(
[ split(/\n/, $js_source) ]
);
my $predef = $opt{predef} || {};
if ( $predef && ref $predef eq 'HASH' ) {
%{$predef} = map {
$_ => ( $predef->{$_} ? JSON
::true : JSON::false )
} keys %{$predef};
}
$opt{predef} = $predef;
my $opt_str = encode_json( {
map {
$_ => (
($JSLINT_OPTIONS{$_} && $JSLINT
package Geo::Coder::ArcGIS;
use strict;
use warnings;
use Carp qw(croak);
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.01';
$VERSION = eval $VERSION;
sub new {
my ($class, %params)
if $self->{https};
$uri->query_form(
SingleLine => $location,
f => 'json',
outFields => '*',
);
my $res = $self->{response} = $self->ua->get(
$u
return unless $res->is_success;
# Change the content type of the response from 'application/json' so
# HTTP::Message will decode the character encoding.
$res->content_type('text/plain');
onse = $self->auth_client->post( @post_args );
=cut
use Carp;
use LWP::UserAgent;
use URI;
use JSON;
use HTTP::Request;
use HTTP::Request::Common;
use Net::OAuth2::Moosey::AccessToken;
use MooseX::
us_line . ": " . $response->decoded_content );
}
my $res_params = _parse_json($response->decoded_content);
$res_params = _parse_query_string($response->decoded_content
tr);
return {$uri->query_form};
}
# Parse json non-fataly
sub _parse_json {
my $str = shift;
my $obj = eval{local $SIG{__DIE__}; decode_json($str)};
return $obj;
}
1;
=head1 LICENSE
pe 'SourceType',
as 'Str',
where { $_ =~ /^(xmldesc|plaintext|json)$/ },
message { 'Source type must be one of xmldes, plaintext, json' };
subtype 'Sigil',
as 'Str',
where { $_ =~ /\A$xml10_nam
=> 'ro',
isa => 'Str',
default => 'Default',
);
has 'source' => ( # Can be XML obj, JSON data struct, or string.
is => 'ro',
required => 1,
);
has 'msdesc' => ( # if we started with
( length( $w_obj->word ) == 0 );
push( @words, $w_obj );
}
return @words;
}
sub _init_from_json {
my( $self, $wit ) = @_;
$self->sigil( $wit->{'id'} );
$self->identifier( $wit->{'name'} );
utf8 => 1,
subscribe_headers => {
transformation => 'jms-to-json',
}
},
);
MyApp->run();
# In a controller, or controller base class:
use base
61613'
},
],
subscribe_headers => {
transformation => 'jms-to-json',
},
connect_headers => {
login => 'myuser',
passcode => 'mypassw
sort => 'lastTime',
dir => 'DESC',
history => JSON::false,
},
};
# Check the args
$self->_check_args($args, $definition);
sort => 'lastTime',
dir => 'DESC',
params => JSON::null,
},
};
# Check the args
$self->_check_args($args, $definition);
#
nition = {
defaults => {
direction => 'DESC',
history => JSON::false,
},
};
# Check the args
$self->_check_args($args, $definition);
n = {
defaults => {
updates => JSON::false,
deletion => JSON::false,
sendevent => JSON::false,
sort => 'name',
di
# Argument definition
my $definition = {
defaults => {
monitor => JSON::false,
start => 0,
limit => 50,
sort => 'name',
n = {
defaults => {
updates => JSON::false,
deletion => JSON::false,
sendEvent => JSON::false,
start => 0,
limit
ification, a simple data
interchange format better suited to low-level network communication than
JSON. See http://tnetstrings.org/ for more details.
use Text::TNetstrings qw(:all);
my $data = enc
kage Redis::Dump::Config;
use Moose;
use MooseX::Types::Path::Class;
with 'MooseX::Getopt';
use JSON;
use Redis 1.904;
# ABSTRACT: It's a simple way to dump and backup config from redis-server
our
} = $value;
}
return %cf;
}
sub _restore {
my $self = shift;
my %keys = %{ from_json( $self->restore->slurp ) };
foreach my $key ( keys %keys ) {
my $value = $keys{$key}
Dumper( \$dump->run );
=head1 DESCRIPTION
It's a simple way to dump config from redis-server in JSON format or any format
you want.
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to pro
xing
Directory;
use 5.008;
use strict;
use warnings 'all';
use parent 'CGI::Application';
use JSON 2.00; # The API was changed
use Try::Tiny;
use WWW::USF::Directory;
sub setup {
my ($self) = @_
ults and response
my (@results, $response);
# Set the header to specity JSON
$self->header_add(-type => 'application/json');
try {
# Search the directory
@results = $self->{directory}->searc
il } } @results;
# Return the JSON-encoded results to print
$response = JSON->new->encode(\@results);
}
catch {
# Return an empty JSON list
$response = JSON->new->encode([]);
};
# Return
used to serialiser/deserialise. See Data::Serializer to see
what is available. Defaults to YAML. JSON is anotther that is available.
=cut
class_type 'Data::Serializer';
my $serializer_t = subtype
package Redis::Dump::Restore;
use Moose;
use MooseX::Types::Path::Class;
use JSON;
with 'MooseX::Getopt';
use Redis 1.904;
# ABSTRACT: It's a simple way to restore data to redis-server based on re
}
}
}
}
sub _set_values_by_keys {
my $self = shift;
my %keys = %{ from_json( $self->file->slurp ) };
$self->_conn->flushall if $self->flushall;
foreach my $key ( ke
xt');
=head1 DESCRIPTION
It's a simple way to restore data to redis-server based on redis-dump (JSON).
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to provide a command line api. The
NAME
HTML::HTML5::Outline - implementation of the HTML5 Outline algorithm
=head1 SYNOPSIS
use JSON;
use HTML::HTML5::Outline;
my $html = <<'HTML';
<!doctype html>
<h1>Hello</h1>
<h2>World</
Morning</h1>
<h2>Vietnam</h2>
HTML
my $outline = HTML::HTML5::Outline->new($html);
print to_json($outline->to_hashref, {pretty=>1,canonical=>1});
=head1 DESCRIPTION
This is an implementation o
algorithm, as per
L<http://www.w3.org/TR/html5/sections.html#outlines>.
The module can output a JSON-friendly hashref, or an RDF model.
=head2 Constructor
=over
=item * C<< HTML::HTML5::Outline->
string - the initial word string that should be parsed into its forms
=item *
json - a hash, presumably read from JSON, that has all the attributes
=item *
empty - a flag to say that this should b
ok( !$word->is_empty, "Word is not empty");
# Initialize a word from a JSON string, check its values
use JSON qw( decode_json );
my $jstring = encode_utf8( '{"c":"Արդ","n":"արդ","punctuation":
"Առդ"}' );
$word = Text::TEI::Collate::Word->new( json => decode_json($jstring), ms_sigil => 'B' );
is( $word->word, 'Առդ', "Got correct JSON word before modification" );
is( $word->canonical_fo