using GD::Graph.
Args:
--key|-k|--key <keyspec> Specify keys that correlate to keys in JSON data
--option|-o option=val Specify custom command for GD::Graph
--label-x <val>
lements
HashRef | {} | Less than 259,080 characters when converted to JSON
=head1 TYPES
The following types may be used to define attributes in L<SimpleDB::Class::Item>s.
derations about this type.
=head2 HashRef
A hash reference. For storage this is serialized into JSON and stored as a C<MediumStr>, therefore it cannot exceed 259,080 characters after serialization.
o your items.
=cut
use warnings;
use strict;
use DateTime;
use DateTime::Format::Strptime;
use JSON;
use MooseX::Types
-declare => [qw(SdbArrayRefOfDateTime SdbDateTime
SdbArrayRefOfS
use strict;
use warnings;
use Test::More;
use File::Basename 'basename';
use JSON::MaybeXS 'decode_json';
use IPC::Open2;
my ($recs) = grep { -e } map { "$_/recs" }
"$ENV{BASE_TEST_DIR}/..", $ENV{D
st loading of both Text::CSV_PP and JSON::PP
is_deeply decode_json(fatpack_ok('fromcsv', { stdin => 'foo,bar,baz' })), { 0 => "foo", 1 => "bar", 2 => "baz" }, 'json matches';
# test operation discove
or (BaseRegistry) discovery
is fatpack_ok('collate -a count', { stdin => '{}' }), '{"count":1}', 'json matches';
# test running of external scripts, with standalone path and -- delimiter
my $script =
art.
Recs, or RecordStream is a collection of scripts that facilitates the parsing
of files into JSON records and the transformation of those records. Many common
UNIX programs like grep, sort, and u
eral
the tools fall into three categories: those that produce JSON records, those
that operate on JSON records, and those that convert JSON records into output.
A typical use of recs will consist of o
nd one of the third type. To begin using recs, you'll have to
decide on how to get your data into JSON. There are several scripts available
to do this, one of the most powerful of which is recs-frommu
val {
require MongoDB;
require JSON::PP;
};
if ( $@ ) {
require Test::More;
import Test::More skip_all => 'Missing modules! (MongoDB or JSON::PP)!';
}
else {
require Test:
art.
Recs, or RecordStream is a collection of scripts that facilitates the parsing
of files into JSON records and the transformation of those records. Many common
UNIX programs like grep, sort, and u
eral
the tools fall into three categories: those that produce JSON records, those
that operate on JSON records, and those that convert JSON records into output.
A typical use of recs will consist of o
nd one of the third type. To begin using recs, you'll have to
decide on how to get your data into JSON. There are several scripts available
to do this, one of the most powerful of which is recs-frommu
use strict;
use warnings;
use utf8;
package App::RecordStream::Operation::tojsonarray;
use base qw(App::RecordStream::Operation);
sub init {
my $this = shift;
my $args = shift;
$this->parse_op
return <<USAGE;
Usage: recs tojsonarray [files]
__FORMAT_TEXT__
This command outputs the record stream as a single JSON array. It
complements the fromjsonarray command.
__FORMAT_TEXT__
Examples
# Save the record stream to a file suitable for loading by any JSON parser
... | recs tojsonarray > recs.json
USAGE
}
1;
ordStream::Operation::fromjsonarray;
our $VERSION = "4.0.25";
use strict;
use warnings;
use base qw(App::RecordStream::Operation);
use App::RecordStream::Record;
use JSON::MaybeXS;
sub init {
$this->{'EXTRA_ARGS'} = $args;
$this->{'FIELDS'} = \@fields;
$this->{'JSON'} = JSON->new();
}
sub wants_input {
return 0;
}
sub stream_done {
my ($this) = @_;
my
is, $fh) = @_;
my $json = $this->{'JSON'};
my $fields = $this->{'FIELDS'};
my $has_fields = scalar @$fields;
my $contents = do { local $/; <$fh> };
my @arrays = $json->incr_parse($content
ct;
use warnings;
use base qw(App::RecordStream::Operation);
use MongoDB;
use Data::Dumper;
use JSON::PP;
sub init {
my $this = shift;
my $args = shift;
my ($host, $user, $pass, $db_name, $q
ssword'} = $pass if defined $pass;
# This will come closer to allowing mongo-hq style json
my $json = JSON::PP->new()
->allow_barekey() # Allow {navItem:[]} instead of {'navItem':[]}
->al
ME'} = $db_name;
$this->{'COLLECTION'} = $collection;
$this->{'QUERY'} = $json->decode($query);
}
sub wants_input {
return 0;
}
sub stream_done {
my $this = shift;
my
ally casts date fields as L<DateTime> objects.
=item *
It automatically serializes hashes into JSON so they can be stored in SimpleDB domain attributes, and deserializes on retrieval.
=item *
It
s];
}
return $domains;
}
=head1 PREREQS
This package requires the following modules:
L<JSON>
L<Sub::Name>
L<DateTime>
L<DateTime::Format::Strptime>
L<Moose>
L<MooseX::Types>
L<MooseX::Class
=head1 NAME
recs-fromjsonarray
=head1 recs-fromjsonarray --help-all
Usage: recs-fromjsonarray <args> [<files>]
Import JSON objects from within a JSON array.
Arguments:
--key|k <keys>
es/%d.json", $self->_id()));
$uri->query_form('limit' => 13, 'offset' => 0); # TODO: Suitable limit (and use offset?)
} elsif ($page == PAGE_PHOTOS) {
$uri->path("/iphone/api/v1/photos.json");
set?)
} elsif ($page == PAGE_REVIEWS) {
$uri->path(sprintf("/iphone/api/v1/movies/%d/reviews.json", $self->_id()));
$uri->query_form('type' => 'critics', 'limit' => 100, 'offset' => 0); # TODO:
v1/movies/%d.json", $id));
my $content = $self->_ws()->_response_decoded_content(GET $uri->as_string());
if ($content =~ m/^\s*$/) {
croak "Resource not found";
}
my $json = $self->_ws
__content()->{$page};
if (! defined $content) {
$content = $self->_ws()->_response_decoded_json($self->_request($page));
$self->__content()->{$page} = $content;
}
return $content;
}
::OpenStack::Attack;
use v5.10;
use Any::Moose;
use HTTP::Async;
use HTTP::Request;
use JSON qw(to_json from_json);
our $VERSION = '1.0500'; # VERSION
has compute => (is => 'ro', isa => 'Net::OpenSt
ers {
my ($self, $num, $image) = @_;
$image ||= $self->get_any_image();
my $body = to_json {
server => {
name => 'stackattack',
imageRef => $image,
{
my ($self, $servers, $image) = @_;
$image ||= $self->get_any_image();
my $body = to_json {
rebuild => {
imageRef => $image,
}
};
my @reqs = map $self
__content()->{$page};
if (! defined $content) {
$content = $self->_ws()->_response_decoded_json($self->_request($page));
$self->__content()->{$page} = $content;
}
return $content;
}
#!/usr/local/bin/perl
use strict;
use warnings;
use Carp;
use SVN::Class;
use FindBin;
use JSON::XS;
use Email::Stuff;
use Sys::Hostname;
my $config = {
src => Path::Class::Dir->new( $FindBin::Bi
) {
my $config_file = Path::Class::File->new( shift @ARGV );
my $supplied_conf = decode_json( $config_file->slurp );
$config = { %$config, %$supplied_conf };
}
if (!$config->{src}) {
ull
system and test summary is printed to stdout.
You may specify an alternate path to test in a JSON-formatted config file.
Use the 'src' config option to specify a path. Example:
{ 'src' : '/pat
N) {
$uri->path(sprintf("/iphone/api/v1/actors/%d.json", $self->_id()));
} elsif ($page == PAGE_PHOTOS) {
$uri->path("/iphone/api/v1/photos.json");
$uri->query_form('actor' => $self->_id(), 'li
v1/actors/%d.json", $id));
my $content = $self->_ws()->_response_decoded_content(GET $uri->as_string());
if ($content =~ m/^\s*$/) {
croak "Resource not found";
}
my $json = $self->_ws
()->_response_decoded_json(GET $uri->as_string());
if ($json->{'id'} ne $id) {
die "id failed round trip"
}
return $id;
} elsif (exists $self->_q()->{'imdbid'}) {
my $imdbid = $self->_
ay be serialized thusly:
my $ser = $dm->freeze({ format => 'JSON' });
# later
my $dm = Data::Manager->thaw($ser, { format => 'JSON' });
This is possible thanks to the magic of L<MooseX::Storag
w(Class::Accessor);
use Cache::FileCache;
use Carp;
use File::Spec::Functions qw(tmpdir);
use JSON;
use LWP::ConnCache;
use LWP::UserAgent;
use WebService::Flixster::Actor;
use WebService::Flixs
ecoded_json {
my $self = shift;
my $request = shift;
my $content = $self->_response_decoded_content($request);
my $json = JSON->new();
$json->utf8(0);
my $resp = $json->deco
:Util::TypeConstraints';
#use Mouse;
#use Mouse::Util::TypeConstraints;
use LWP::UserAgent;
use JSON;
#use URI;
use URI::Escape;
use Ouch qw(:traditional);
use Regexp::Common qw /URI/;
our $VERSION
veloper specifies in pixels.
=head3 format (default: json)
The response format – Accepted values: (xml, json)
=head3 callback
Returns a (jsonp) response format. The callback is the name of the j
rent.
=head3 allowscripts (default: false)
By default Embedly does not return script embeds for jsonp requests. They just don’t work and cause lots of issues. In some cases, you may need the scrip