utility class to mock the responses from Selenium server
use strict;
use warnings;
use Moo;
use JSON;
use Carp;
use Try::Tiny;
use HTTP::Response;
use Data::Dumper;
extends 'Selenium::Remote::Remot
undef;
my $json = JSON->new;
$json->allow_blessed;
my $decoded_json = $json->allow_nonref(1)->utf8(1)->decode(<$fh>);
close($fh);
$self->session_store($decoded_json);
}
sub dump_
n_store->{$path};
}
my $json = JSON->new;
$json->allow_blessed;
my $json_session = $json->allow_nonref->utf8->pretty->encode($dump);
print $fh $json_session;
close($fh);
}
sub
I
package WWW::Mixcloud;
use Moose;
use namespace::autoclean;
use URI;
use LWP::UserAgent;
use JSON;
use DateTime::Format::Atom;
use Carp qw/ croak /;
use WWW::Mixcloud::Cloudcast;
use WWW::Mixclo
= $self->ua->get( $API_BASE . $uri->path );
if ( $res->is_success ) {
return decode_json $res->content;
}
else {
croak 'API error: ' . $res->content;
}
}
1;
__END__
Experimental support for MYMETA
if ( $ENV{X_MYMETA} ) {
if ( $ENV{X_MYMETA} eq 'JSON' ) {
$self->Meta->write_mymeta_json;
} else {
$self->Meta->write_mymeta_yaml;
}
}
return 1;
}
1;
at least 5.8
use 5.008;
use strict;
use warnings;
use Mac::AppleScript qw(RunAppleScript);
use JSON::XS;
use Encode qw(encode decode);
use Carp qw(croak);
use Mac::Safari::JavaScript::Exception;
ou return from your JavaScript will be encoded into JSON with
Safari's native C<JSON.stringify> function and decoded on the Perl side
using the JSON::XS module.
JavaScript data structures are mapped
d C<false> to C<undef>, JSON::XS::true
(which you can treat like the scalar C<1>) and JSON::XS::false (which you
can treat like the scalar C<0>) respectivly. Please see L<JSON::XS>
for more informati
p::Admin;
{
$Hadoop::Admin::VERSION = '0.4';
}
use warnings;
use Moose;
use LWP::UserAgent;
use JSON -support_by_pp;
has 'namenode' => (
is => 'ro',
isa => 'Str',
reader => 'get_nameno
Value=();
use Data::Dumper;
foreach my $hostref ( @{$self->{'JobTrackerInfo_AliveNodesInfoJson'}} ) {
push @returnValue, $hostref->{'hostname'};
}
return @returnValue;
}
sub tasktrac
;
my @returnValue=();
foreach my $hostref ( @{$self->{'JobTrackerInfo_BlacklistedNodesInfoJson'}} ) {
push @returnValue, $hostref->{'hostname'};
}
return @returnValue;
}
sub tasktrac
trict;
use warnings;
use JSON;
use LWP::UserAgent;
use URI::Encode qw( uri_encode );
use Carp qw/croak/;
my $API_BASE = 'http://api.facebook.com/method/fql.query?format=json&query=';
sub query {
encode( $API_BASE . $args->{query} ) );
if ( $response->is_success ) {
return decode_json $response->content;
}
else {
croak $response->status_line;
}
}
1;
__END__
ike_count FROM link_stat WHERE url="http://twitter.com"'
});
Returns a hash reference of the JSON returned from the API.
=head1 SEE ALSO
L<Facebook>, L<WWW::Facebook::API>, L<WWW::Facebook::FQL
0.11';
}
use Grimlock::Schema::Candy -components => [
qw(
TimeStamp
Helper::Row::ToJSON
+DBICx::MaterializedPath
)
];
use HTML::Scrubber;
resultset_class 'Grimlock::Schema
ne->name;
return $date_time;
}
sub TO_JSON {
my $self = shift;
return {
reply_count => $self->reply_count,
children => $self->children_TO_JSON,
parent => $self->parent,
body
=> $self->body,
%{ $self->next::method },
}
}
sub children_TO_JSON {
my $self = shift;
my $children_rs = $self->children;
my @child_collection;
push @child_collection, {
entryid
::Candy -components => [
qw(
InflateColumn::DateTime
TimeStamp
Helper::Row::ToJSON
EncodedColumn
)
];
use Data::Dumper;
use Text::Password::Pronounceable;
resultset_cl
}
);
}
sub TO_JSON {
my $self = shift;
return {
created_at => $self->created_at . "",
updated_at => $self->updated_at . "",
entries => $self->entries_TO_JSON,
%{ $self->next
::method },
};
}
sub entries_TO_JSON {
my $self = shift;
my $entry_rs = $self->entries;
my @entry_collection;
push @entry_collection, {
entryid => $_->entryid,
title => $_->title,
del
__PACKAGE__->config(
server => 'http://localhost:3000',
type => 'application/json',
clientattrs => {timeout => 5},
);
# controller
sub foo : Local {
my ($self, $c) = @_;
sub send_msg {
my ($self, $msg) = @_;
my $json = JSON::encode_json($msg);
$self->writer->write( "Content-Type: application/json\n\n$json\n--" . $self->boundary. "\n" );
}
1;
__END__
=he
'text/html' => [ 'View', 'HTML' ],
'application/json' => [ 'View', 'JSON' ],
'text/x-data-dumper' => [ 'Data::Serializer', 'Data::Du
mpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
ta or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_da
lt => 1,
'File::ShareDir' => '1.00',
);
features(
'JSON support', [
-default => 0,
'JSON' => '2.00',
'JSON::XS' => '2.00',
],
'YAML support', [
'YAML' => '
r an
L<Inline>-based module. This writes C<Makefile>, C<META.yml>, and
C<MYMETA.yml> (or C<MYMETA.json>) if you set an experimental
environmental variable C<X_MYMETA>.
=head2 WriteMakefile (L<Module:
mymeta_json (L<Module::Install::Metadata>)
write_mymeta_yaml;
write_mymeta_json;
B<write_mymeta_yaml> command and B<write_mymeta_json> command are to
write C<MYMETA.yml> and C<MYMETA.json> respe
on_error on_message trusted_origin );
use AnyEvent;
use AnyEvent::Handle;
use Plack::Request;
use JSON;
use HTTP::Date;
use Digest::MD5 qw(md5);
sub call {
my ($self, $env) = @_;
my (undef,
ndler) = @_;
my $req = Plack::Request->new($env);
$env->{'hippie.message'} =
JSON::from_json($req->parameters->mixed->{'message'}, { utf8 => 1 });
$env->{'PATH_INFO'} = '/message';
$frame->next_bytes) {
$env->{'hippie.message'} = eval { JSON::decode_json($message) };
if ($@) {
package Net::OneTimeSecret;
our $VERSION = "0.04";
use common::sense;
use JSON;
use LWP::UserAgent;
use URI::Escape;
use Encode qw( encode_utf8 decode_utf8 );
my $_USER_AGENT = LWP::UserAgent->new
a );
return from_json( decode_utf8( $response->decoded_content ) );
}
sub _get {
my ($self, $url) = @_;
my $response = $_USER_AGENT->get( $url );
return from_json( $response->decoded_
ent
You call it with Perl data, and get back Perl data. No messing
with encoding or decoding of JSON.
=item * Unicode
Unicode, errrm, seems to work OK.
=back
=head1 DESCRIPTION
See https://one
qw(DUI.js
Stream.js
hippie.js
hippie.pipe.js
jquery.ev.js
json2.js)
}
1;
__END__
=head1 NAME
Web::Hippie::App::JSFiles - Serve javascript files for Web::Hip
my ($self, $msg) = @_;
my $bytes = Protocol::WebSocket::Frame->new
( buffer => JSON::encode_json($msg),
version => $self->version)->to_bytes;
$self->h->push_write($bytes);
}
$writer = $responder->
([200,
[ 'Content-Type' => 'application/json',
'Cache-Control' => 'no-cache, must-revalidate',
'Pragma
ate::time2str(time())
]]);
$sub->poll_once(sub { $writer->write(JSON::encode_json(\@_));
$writer->close });
}
}
elsif ($en
r::VERSION = '0.05';
}
use Moose;
# ABSTRACT: A way to iterator over results from Bullfinch
use JSON::XS;
use Net::Bullfinch;
with 'Data::Stream::Bulk::DoneFlag';
has 'bullfinch' => (
is
fined $resp ) {
$kestrel->confirm( $resp_queue, 1 );
my $decoded = decode_json( $resp );
if ( exists $decoded->{'EOF'} ) {
$self->_set_done;
fined $resp ) {
$kestrel->confirm( $resp_queue, 1 );
my $decoded = decode_json( $resp );
if ( exists $decoded->{'EOF'} ) {
last;
}
e),
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
my $user