vent::Twitter;
use AnyEvent::Twitter::Stream;
use HTML::Entities;
use Regexp::Common qw/URI/;
use JSON::MaybeXS;
with 'MooseX::Log::Log4perl';
=head1 NAME
POE::Component::Server::Twirc - Twitter/IR
twitter_rest_api_request => 'request',
},
);
sub to_json { JSON::MaybeXS->new->encode($_[1]) }
sub to_pretty_json { JSON::MaybeXS->new->pretty>encode($_[1]) }
# force build of users by
keepalive");
},
on_friends => sub {
TRACE("on_friends: ", $self->to_json(@_));
$self->yield(friends_ids => shift);
},
on_event => sub {
r::Logger::Entry;
use Zonemaster;
use List::MoreUtils qw[none];
use Scalar::Util qw[blessed];
use JSON::XS;
has 'entries' => (
is => 'ro',
isa => 'ArrayRef[Zonemaster::Logger::Entry]
elf->entries;
splice @$r, 0, scalar( @$r );
return;
}
sub json {
my ( $self, $min_level ) = @_;
my $json = JSON::XS->new->allow_blessed->convert_blessed->canonical;
my %numeri
{args} = $m->args if $m->args;
push @out, \%r;
}
return $json->encode( \@out );
} ## end sub json
no Moose;
__PACKAGE__->meta->make_immutable;
1;
=head1 NAME
Zonemaster::Log
rsion => $Module::Find::VERSION } );
info( DEPENDENCY_VERSION => { name => 'JSON', version => $JSON::VERSION } );
info( DEPENDENCY_VERSION => { name => 'File::ShareDir',
);
$client->is_alive() or die "riak is not alive";
# store hashref. will be serialized as JSON
$client->put( 'bucket_name', 'key_name', { some => 'structure' } );
# store text
$client->
ue as first argument. If the content_type
of the fetched value is C<'application/json'>, automatically decodes the JSON
into a Perl structure. If you need the raw data you can use C<get_raw>.
=head2
client->get_raw($bucket, $key, $coderef);
Same as C<get>, but no automatic JSON decoding will be performed. If you want
JSON to be automatically decoded, you should use C<get()> instead.
=head2 put(
head1 CONFIGURATION
C<Twirc> uses L<Config::Any>, so you can configure C<twirc> using XML, YAML,
JSON, Apache-style configuration, Windows INI file format, or even Perl code.
A configuration file is
package Net::LDNS::Packet;
use 5.10.1;
use Net::LDNS;
use MIME::Base64;
sub TO_JSON {
my ( $self ) = @_;
return {
'Net::LDNS::Packet' => {
data => encode_base64(
istogram ();
use JSON::XS ();
# rest of implementation in C, see XS.xs and mh_axis.h
sub serialize {
my $self = shift;
my $hash = $self->_as_hash;
return JSON::XS::encode_json($hash);
}
sub d
eserialize {
my $class = shift;
my $hash = JSON::XS::decode_json(ref($_[0]) ? ${$_[0]} : $_[0]);
return $class->_from_hash($hash);
}
1;
__END__
=head1 NAME
Math::Histogram::Axis - Object
nbins + 1> for overflow.
=head2 serialize
Returns a JSON string that represents this axis object.
=head2 deserialize
Class method. Given a JSON string as generated by C<serialize()>,
recreates the
#!/usr/bin/env perl
use 5.14.2;
use warnings;
use JSON::XS;
my $json = JSON::XS->new->canonical->pretty->utf8;
say $json->encode($json->decode(join('',<>)));
obox
=head3 L<autodie> 2.22
=head3 L<autobox::Core>
=head3 L<autobox::dump>
=head3 L<autobox::JSON>
=head3 L<autobox::Colors>
=head2 Other Libraries I Use
=head3 L<aliased>
=head3 L<lib::if::d
e Zonemaster::Recursor;
use Net::LDNS;
use Net::IP::XS qw(:PROC);
use Time::HiRes qw[time];
use JSON::XS;
use MIME::Base64;
use Module::Find qw[useall];
use Carp;
use List::Util qw[max min sum];
us
rn $self->string cmp $other->string;
}
sub save {
my ( $class, $filename ) = @_;
my $json = JSON::XS->new->allow_blessed->convert_blessed;
open my $fh, '>', $filename or die "Cache save
foreach my $addr ( keys %{ $object_cache{$name} } ) {
say $fh "$name $addr " . $json->encode( $object_cache{$name}{$addr}->cache->data );
}
}
close $fh or die $!;
package Zonemaster::Logger::Entry v1.0.0;
use 5.14.2;
use Time::HiRes qw[time];
use JSON;
use Moose;
use Zonemaster;
use overload '""' => \&string;
our %numeric = (
DEBUG3 => -2,
DEBUG2
2,
WARNING => 3,
ERROR => 4,
CRITICAL => 5,
);
our $start_time = time();
my $json = JSON::XS->new->allow_blessed->convert_blessed->canonical;
has 'module' => ( is => 'ro', isa =>
uninitialized';
$argstr = join( ', ',
map { $_ . '=' . ( ref( $self->args->{$_} ) ? $json->encode( $self->args->{$_} ) : $self->args->{$_} ) }
sort keys %{ $self->args } )
i
Moose;
use JSON::PP;
use Zonemaster::Util;
use Net::IP::XS;
use Zonemaster;
my $seed_data;
our %recurse_cache;
{
local $/;
my $json = <DATA>;
$seed_data = decode_json $json;
}
sub rec
els = ( $label, @{ $self->labels } );
return $self->new( { labels => \@labels } );
}
sub TO_JSON {
my ( $self ) = @_;
return $self->string;
}
## no critic (Modules::RequireExplicitIncl
NS tree.
=item prepend($label)
Returns a new L<Zonemaster::DNSName> object, representing the called one with the given label prepended.
=item TO_JSON
Helper method for JSON encoding.
=back
=cut
package Couchbase::Bucket;
use strict;
use warnings;
use JSON::MaybeXS;
use URI;
use Storable;
use Couchbase::Core;
use Couchbase::_GlueConstants;
use Couchbase::Document;
use Couchbase::Settings;
TPDocument;
use Couchbase::N1QL::Handle;
my $_JSON = JSON::MaybeXS->new()->allow_nonref;
sub _js_encode { $_JSON->encode($_[0]) }
sub _js_decode { $_JSON->decode($_[0]) }
sub new {
my ($pkg, $co
);
$self->connect() unless $noconn;
$self->_encoder(CONVERTERS_JSON, \&_js_encode);
$self->_decoder(CONVERTERS_JSON, \&_js_decode);
$self->_encoder(CONVERTERS_STORABLE, \&Storable::fr
package Zonemaster::Config v1.0.1;
use 5.14.2;
use Moose;
use JSON;
use File::ShareDir qw[dist_dir dist_file];
use File::Slurp;
use Hash::Merge;
use File::Spec;
use Zonemaster;
has 'cfiles' => (
g_directory_list() ) {
my $cfile = File::Spec->catfile( $dir, 'config.json' );
my $new = eval { decode_json read_file $cfile };
if ( $new ) {
$config = $merger->mer
s }, $cfile;
}
my $pfile = File::Spec->catfile( $dir, 'policy.json' );
$new = eval { decode_json read_file $pfile };
if ( $new ) {
my $tc = $new->{__testca
s );
}
my $from = $self->packet->answerfrom // '<unknown>';
return $from;
}
sub TO_JSON {
my ( $self ) = @_;
return { 'Zonemaster::Packet' => $self->packet };
}
no Moose;
__PA
thod, that replaces udnefined values with the string C<E<lt>unknownE<gt>>.
=item TO_JSON
Support method for L<JSON> to be able to serialize these objects.
=back
=head1 METHODS PASSED THROUGH
Thes
users => 'a, b, c, d',
},
],
latest_label => {
is_bad => JSON::true,
time => 1350201660000,
reasons => [
'$chargebac
as bad (or not bad).
B<Request:>
label_user('billy_jones_301', {
'$is_bad' => JSON::true,
'$reasons' => ['$chargeback'],
'$description' => 'Freeform text descri
=> '1-415-555-6040',
'$referrer_user_id' => 'janejane101',
'$changed_password' => JSON::true,
...
});
B<Response:>
{
error_message => 'OK',
status
t;
my $method = shift || 'TO_JSON';
my $config = shift;
if (ref $method && ref $method ne 'CODE') {
$config = $method;
$method = 'TO_JSON';
}
return ext_parcel(
use JSON::MaybeXS;
use Web::Util::ExtPaging;
sub dispatch_request {
my $people_rs = get_rs();
sub (/people) {
[
200,
[ 'Content-type', 'application/json' ],
[ encode_json(ext_paginate($rs->search(undef, { rows => 25 }))) ],
]
},
sub (/people_lite) {
[
200,
[ 'Content-type', 'application/json' ],
[
use Couchbase::_GlueConstants;
use Couchbase::N1QL::Params;
use JSON::MaybeXS;
use base (qw(Couchbase::View::Handle));
my $JSON = JSON::MaybeXS->new->allow_nonref;
sub new {
my ($cls, $bucket,
h %$qargs) {
$pobj->namedparam("\$$k", $JSON->encode($v));
}
} elsif (ref $qargs eq 'ARRAY') {
$pobj->posparam($JSON->encode($_)) for @$qargs;
}
while (my ($k,
urn bless $self, $cls;
}
sub process_meta {
my ($self) = @_;
eval {
$self->meta($JSON->decode($self->meta));
}; if ($@) {
return;
}
$self->_priv->{errinfo} = $sel
cessor {
accessors => [ qw(cbo) ]
};
use constant {
DESIGN_NAME => "blog"
};
my $DESIGN_JSON = {
_id => "_design/blog",
language => "javascript",
views => {
recent_posts
st(no_plan) {
my $self = shift;
my $o = $self->cbo;
my $ret = $o->design_put($DESIGN_JSON);
ok($ret->is_ok, "Design doc put did not return errors");
my $design = $o->design_get(D
ve HTTP 200");
ok($design->is_ok, "Overall object OK");
is_deeply($design->value, $DESIGN_JSON, "Got back view");
}
sub TV02_create_invalid_ddoc :Test(no_plan) {
my $self = shift;
my