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;
' => [ '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::
Socket::INET;
use POSIX qw(EINTR EAGAIN EWOULDBLOCK);
use Socket qw(IPPROTO_TCP TCP_NODELAY);
use JSON::XS ();
our $CRLF = "\x0d\x0a";
our $DELIMITER = "\x20";
our $MAX_REQUEST_SIZE = 131072;
o
'request' => 1,
'request_background' => 1,
'request_multi' => 1,
);
our $JSON;
sub new_client {
my $address = shift;
my $sock = IO::Socket::INET->new(
PeerAd
ROTO_TCP, TCP_NODELAY, pack("l", 1)) or die;
$sock->autoflush(1);
$sock;
}
sub json {
$JSON ||= JSON::XS->new->allow_nonref;
}
sub support_cmd {
$CMD2NO{+shift};
}
sub make_request
',
fields => [qw(code text)],
},
);
use namespace::clean;
use Moose;
extends 'JSON::RPC::LWP';
has client => (
is => 'ro',
isa => 'Games::Lacuna::Client',
required => 1,
w
se
DateTime
Exception::Class
FindBin
HTTP::Request
HTTP::Response
IO::Interactive
JSON::RPC::Common
JSON::RPC::LWP
LWP::UserAgent
Math::Round
MIME::Lite
Moose
Number::Format
Scalar::Util
shift;
my $options = [
['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>
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
char json_bc[] =
"\102\103\107\110\001\020\000\000\020\000\000\000\023\004\211\214\001\124\250\210"
"\010\100\105\106\001\102\144\204\034\040\104\210\314\004\201\042\043\200\311\231"
"\040\140\144\00
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
$foo = RESTExample->new(
server => 'http://localhost:3000',
type => 'application/json',
user => 'mee',
passwd => 'sekrit',
);
$foo->bar;
# controller
sub foo : L
package WWW::Mixpanel;
use strict;
use warnings;
use LWP::UserAgent;
use MIME::Base64;
use JSON;
BEGIN {
$WWW::Mixpanel::VERSION = '0.04';
}
sub new {
my ( $class, $token, $use_ssl, $api_key, $
unless $token;
my $ua = LWP::UserAgent->new;
$ua->timeout(180);
$ua->env_proxy;
my $json = JSON->new->allow_blessed(1)->convert_blessed(1);
bless { token => $to
data_api => 'mixpanel.com/api/2.0/',
json => $json,
ua => $ua, }, $class;
}
sub track {
Request;
use Plack::Builder;
use Plack::App::Cascade;
use Web::Hippie;
use Web::Hippie::Pipe;
use JSON;
use Carp qw/croak cluck/;
# bus = AnyMQ pubsub client bus
# keep_alive = seconds between "ping"
package Net::Twitter::Stream;
use strict;
use warnings;
use IO::Socket;
use MIME::Base64;
use JSON;
use IO::Socket::SSL;
our $VERSION = '0.28';
1;
=head1 NAME
Using Twitter's streaming api.
=head1
2651' );
sub got_tweet {
my ( $tweet, $json ) = @_; # a hash containing the tweet
# and the original json
print "By: $tweet->{user}{screen_name}\n";
/filter.json api call can be use to track up to 200 keywords
and to follow 200 users.
HTTP Basic authentication is supported (no OAuth yet) so you will need
a twitter account to connect.
JSON format
package Net::API::Gett::Request;
use Moo;
use Sub::Quote;
use Carp qw(croak);
use JSON;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Headers;
our $VERSION = '1.06';
=head1 NAME
Net::AP
f = shift;
my $hr = shift;
return encode_json($hr);
}
sub _decode {
my $self = shift;
my $json = shift;
return decode_json($json);
}
sub _send {
my $self = shift;
my $m
e.
Input:
=over
=item * endpoint fragment
=back
Output:
=over
=item * Perl hash ref of the JSON response from the API
=back
Gives a fatal error under any error condition.
=back
=cut
sub ge
Net::MessageBus::Base';
use Net::MessageBus::Message;
use IO::Socket::INET;
use IO::Select;
use JSON;
$| = 1;
=head1 SYNOPSIS
This module implements the client side of the Message Bus.
use N
$/ = "\n";
my $socket = $self->{server_socket};
eval {
print $socket to_json( {type => $type, payload => $object} );
};
if ($@) {
$self->logger->error("M
s/(.*?)\n+// ) {
my $text = $1;
my $data = from_json($text);
if (defined $data->{type} && $data->{type} eq 'message') {
:all/;
use Carp qw/carp croak confess cluck/;
use Data::Dumper;
use Scalar::Util qw/weaken/;
use JSON;
use LWP::UserAgent;
our $VERSION = '0.004';
sub new {
my $class = shift;
my %args = v
params => \%args);
$self->{cookie} = '';
my $decoded = eval { decode_json($response->decoded_content) };
if ($@) {
# probably could not connect at all
$args{user};
return $self;
}
sub logout {
my $self = shift;
my $decoded = decode_json($self->raw_query(method => 'user.logout')->decoded_content);
if ($decoded->{error}) {
ad1 VERSION
Version 0.08
=cut
our $VERSION = '0.08';
use base qw(Net::MessageBus::Base);
use JSON;
use IO::Select;
use IO::Socket::INET;
use Net::MessageBus::Message;
#handle gracefully the dea
$request = from_json($text);
};
if ($@) {
print $fh to_json({status => 0, status_message => $@
f ($request->{type} eq "message") {
print $fh to_json({status => 1});
my $message = Net::MessageBus::M
sub clone
{
my $self = shift;
my $other = $$self;
bless \$other, ref $self;
}
sub TO_JSON { ${$_[0]} }
sub _no_scheme_ok { 0 }
sub _scheme
{
my $self = shift;
unless (@_) {
re
..
localhost> .encoding utf-8
localhost> .server xxx
localhost> .reconnect
localhost> .output json
=head1 DESCRIPTION
Redis and Perl share similar data types, therefore I thought it would be use
nklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
use LWP::UserAgent;
use URI::Escape;
use JSON;
# Create a new instance;
# parameters are passed with key => value
# with parameters server, pu
s->is_success) {
# JSON decode and evaluate result
my $results;
eval {
$results = decode_json($res->content);
};
if ($@) {
$self->errorLog("Could not JSON decode: " . $res->content);
return 0;
} else {
retur