b config {
$_[0]->{ide}->config;
}
sub encode {
require JSON::XS;
JSON::XS->new->encode( $_[1] );
}
sub decode {
require JSON::XS;
JSON::XS->new->decode( $_[1] );
}
1;
# Copyright 2008-2012 T
' => [ 'fing', 'fang', 'foom' ],
}
);
my $json = '{"foo":"bar","zoo":{"blah":"biz","far":["fing","fang","foom"]}}';
my $handle = IO::String->new($json);
ok(my $stream = App::RecordStream::InputS
Stream::InputStream->new(STRING => $json), "String Initialize");
is_deeply($string_stream->get_record(), $hash, 'String Basic Input');
my $multiple = "$json\n$json\n";
ok(my $multiple_stream = App::
array,$r->IODEF->to_tree());
}
return ('') unless($#array > -1);
require JSON;
return(JSON::to_json(\@array));
}
{
my %cache;
sub GetCustomField {
my $field = shift or
# Non-preprocessed C
java => 'text/x-java',
js => 'application/javascript',
json => 'application/json',
lsp => 'application/x-lisp',
lua => 'text/x-lua',
m => 'text/x-matlab',
ipt',
supertype => 'text/x-csrc',
);
Padre::MIME->create(
type => 'application/json',
name => 'JSON',
supertype => 'application/javascript',
);
Padre::MIME->create(
type => 'appl
nts {
'application/javascript' => 'Padre::Plugin::JavaScript::Document',
'application/json' => 'Padre::Plugin::JavaScript::Document',
}
The C<registered_documents> method can be u
vent (@events) {
# send as json to connected listeners
foreach my $connection ($self->bus->all_connections) {
$connection->push_write(json => $event);
}
}
};
1
:ParseJsonIodef;
require CIF::Archive;
require JSON;
sub Prepare { return 1; }
sub Commit {
my $self = shift;
my $r = $self->TicketObj->IODEF();
my $ret = CIF::FeedParser::ParseJsonIodef:
:parse({},JSON::to_json([$r->to_tree()]));
foreach(@$ret){
$_->{'severity'} = 'low';
$_->{'detecttime'} = DateTime->from_epoch(epoch => time());
my ($err,$id) = CIF::Archi
:ParseJsonIodef;
require CIF::Archive;
require JSON;
sub Prepare { return 1; }
sub Commit {
my $self = shift;
my $r = $self->TicketObj->IODEF();
my $ret = CIF::FeedParser::ParseJsonIodef:
:parse({},JSON::to_json([$r->to_tree()]));
foreach(@$ret){
$_->{'detecttime'} = DateTime->from_epoch(epoch => time());
my ($err,$id) = CIF::Archive->insert($_);
warn $err
w AnyEvent::Handle
fh => $fh,
on_read => sub {
$h->push_read(json => sub {
my (undef, $evt) = @_;
$self->handle_event($evt);
pp::RecordStream::OptionalRequire::optional_use(qw(JSON decode_json));
is($loaded, 1, 'Test external module with extra args');
my $hash = decode_json('{"foo": "bar"}');
is($hash->{'foo'}, 'bar', "Tes
ad1 SYNPOSIS
A set of programs for creating, manipulating, and outputing a stream of
Records, or JSON hashes. Inspired by Monad.
=head1 DESCRIPTION
The recs system consists of 3 basic sets of scri
cripts is JSON hashes separated by new
lines. If you wish to write your own recs script in your own language, just
get a JSON parser and you should be good to go. The recs scripts use
JSON::Syck, a
=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>
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 =
using MetaCPAN JSON API
$self->{model} = $self->metacpan_autocomplete($query);
} elsif ( $command eq 'pod' ) {
# Find the POD's HTML and SYNOPSIS section
# using MetaCPAN JSON API
$self->{m
,
);
# Convert ElasticSearch Perl query to a JSON request
require JSON::XS;
my $json_request = JSON::XS::encode_json( \%payload );
# POST the json request to api.metacpan.org
require LWP::User
Content => $json_request,
);
unless ( $response->is_success ) {
TRACE( sprintf( "Got '%s' from metacpan.org", $response->status_line ) )
if DEBUG;
return [];
}
# Decode json response the
n',
htm => 'text/html',
html => 'text/html',
js => 'application/javascript',
json => 'application/json',
latex => 'application/x-latex',
lsp => 'application/x-lisp',
lua => 'text/x-l
package App::RecordStream::Stream::Base;
use JSON qw(decode_json);
use App::RecordStream::Record;
use App::RecordStream::OutputStream;
sub new
{
my $class = shift;
my $this =
{
};
bless
$line);
}
sub accept_line
{
my $this = shift;
my $line = shift;
my $record = App::RecordStream::Record->new(decode_json($line));
return $this->accept_record($record);
}
sub finish
{
}
1;
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>
ection <COLLECTION_NAME> Name of collection to query against
--query <QUERY> JSON query string to run against the --
collection
--filename-
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
t: its
fields, document count, and so on. The Segment object itself writes one
file, C<< segmeta.json >>; besides storing info needed by Segment
itself, the "segmeta" file serves as a central reposit
d twice.
=over
=item *
B<key> - String identifying an index component.
=item *
B<metadata> - JSON-izable data structure.
=back
=head2 fetch_metadata(key)
Fetch a value from the Segment's metad