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
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
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
iguration as JSON
my $cfg_json = to_json($toolbar_cfg);
# Do some replacements so that the JSON data can be made into a JS string
# wrapped in single quotes
$cfg_json =~ s!\\!\\\\
!gm;
$cfg_json =~ s!\n!\\\n!gm;
$cfg_json =~ s!'!\\'!gm;
$html =~ s/%DEBUGTOOLBAR_CFG%/$cfg_json/m;
my $uri_base = request->uri_base . $path_prefix;
$html =~ s/%BASE%/$uri_ba
'0.4002';
use Any::Moose;
use Carp qw( croak );
use HTTP::Request::Common;
use HTTP::Status;
use JSON;
use LWP::UserAgent;
use Net::OAuth::Simple;
use WWW::TypePad::Error;
# TODO import flag to prel
my $api = shift;
my( $key ) = @_;
return $api->call_anon( GET => '/api-keys/' . $key . '.json' );
}
sub uri_for {
my $api = shift;
my( $path ) = @_;
$path = '/' . $path unless $p
$method eq 'PUT') and $qs) {
$extra{ContentBody} = JSON::encode_json($qs);
$extra{ContentType} = 'application/json';
}
my $oauth = $api->oauth;
$res =
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') {
TP;
use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use WWW::DNSMadeEasy::Domain;
our $VERSION ||= '0.0development';
has api_key => (
is => 'ro'
request->header('Accept' => 'application/json');
if (defined $data) {
$request->header('Content-Type' => 'application/json');
$request->content(encode_json($data));
}
my $res = $self->_http_age
nt->request($request);
if ($res->is_success) {
return decode_json($res->content);
} else {
die __PACKAGE__.' HTTP request failed: '.$res->status_line, "\n";
}
}
#
# DOMAINS
#
sub path_domains
structures.
=cut
use strict;
use warnings;
use Carp;
use HTTP::Request;
use LWP::UserAgent;
use JSON::Any;
our $VERSION = '0.02';
our $states = { 'ok' => 0, 'warning' => '1', 'critical' => '2', 'u
;
$self->{'_url'} = $self->_get_url();
$self->{'_ua'} = LWP::UserAgent->new;
$self->{'_json'} = JSON::Any->new;
return $self;
}
sub _get_url {
my $self = shift;
return sprintf('%s://%s/
sword'});
my $req = HTTP::Request->new( GET => $url );
$req->header( 'Content-Type' => 'text/json' );
$req->header( 'X-Username' => $self->{'user'} );
$req->header( 'X-Password' => $self->{'p
ziness, $language ) = ( 25, 50, 'Default' );
my( $CSV, $storable, $outfile, $infile, $text, $cx, $json, $debug, %argspec );
GetOptions( 'csv' => \$CSV,
'width=i' => \$col_width,
'storable'
s' => \$outfile,
'store=s' => \$infile,
'text' => \$text,
'cx' => \$cx,
'json' => \$json,
'debug:i' => \$debug,
'argspec=s' => \%argspec,
'fuzziness=i' => \$fuzzines
', 'sliding' => 0, 'inclusive' => 0 );
}
## Get busy.
my( @files ) = @ARGV;
if( $json ) { # The 'file' is the JSON string.
my @lines;
while( <> ) {
push( @lines, $_ );
}
@files = (
ormats
JSON_FT => "json",
XML_FT => "xml",
YAML_FT => "yaml",
TEXT_FT => "text",
HTML_FT => "html",
# Content Types
JSONP_CT => "text/javascript",
JSON_CT => "a
pplication/json",
XML_CT => 'text/xml',
YAML_CT => 'application/yaml',
TEXT_CT => "text/plain",
};
=head1 SYNOPSIS
Similar in functionality to the standard Dancer serialisation routi
a format using templates
=item Allows per-call configuration of default format
=item Works with jsonp
=back
use Dancer::Plugin::FormattedOutput;
get '/some/route' => sub {
my $dat
package Business::Cart::Generic::View::Search;
use strict;
use warnings;
use JSON::XS;
use Moose;
extends 'Business::Cart::Generic::View::Base';
use namespace::autoclean;
our $VERSION = '0.85';
package Business::Cart::Generic::View::Product;
use strict;
use warnings;
use JSON::XS;
use Moose;
use Text::Xslate 'mark_raw';
extends 'Business::Cart::Generic::View::Base';
use namespace::auto
$data_dir->mkpath or die "coudln't make path to $data_dir";
my $index = $data_dir->file('index.json');
$index->touch;
my $archive = $data_dir->file('archive.sqlite');
return Metabase::Libra
eTime;
use Scaffold::Class
version => $VERSION,
base => 'Scaffold::Handler',
codec => 'JSON',
;
# ----------------------------------------------------------------------
# Public Methods
#
;
$self->stash->view->template_disabled(1);
$self->stash->view->content_type('application/json');
}
# ----------------------------------------------------------------------
# Private Methods
Defaults to false, unless C<uuid.h> can be found and you have a compiler.
=item L<JSON::XS>
Provides faster JSON performance.
Defaults to true if you have a compiler.
=item L<YAML::XS>
Allows d
vent (@events) {
# send as json to connected listeners
foreach my $connection ($self->bus->all_connections) {
$connection->push_write(json => $event);
}
}
};
1
},
headers => $fin->accept_header_for_json,
on_success => sub {
my $response = shift;
my $h = $class->json->decode($response->content);
$class->
h
);
}
);
}
sub update {
my $self = shift;
my $payload = $self->json->encode({policy => $self->policy, exceptions => $self->exceptions});
$self->fin->put(
path),
query => { action => $self->action },
headers => $self->fin->headers_for_json,
payload => $payload
);
}
no Moose;
no MooseX::ClassAttribute;
__PACKAGE__->meta->ma
MooseX::ConfigFromFile";
use JSON 2.0;
sub get_config_from_file {
my($file) = @_;
open my $fh, "<", $file or confess "open: $file: $!";
local $/;
my $json = <$fh>;
close $fh or di
e "close: $file: $!";
return JSON->new->relaxed->utf8->decode($json);
}
}
use Data::Munge;
use IO::File;
use IPC::Run ();
use Term::ReadKey ();
use Term::ReadLine;
use Text::Balanced ();
use Try
nings;
use JSON qw( from_json );
sub lover {
my ( $self, $lover ) = @_;
my $response =
$self->{'ua'}
->post("http://www.colourlovers.com/api/lover/$lover?format=json");
retu
->{'ua'}
->post( $url || 'http://www.colourlovers.com/api/lovers?format=json',
$args );
return from_json $response->content;
}
sub lovers_new {
my ( $self, $args ) = @_;
re
/api/lovers/new?format=json' );
}
sub lovers_top {
my ( $self, $args ) = @_;
return $self->lovers( $args,
'http://www.colourlovers.com/api/lovers/top?format=json' );
}
1;
__END__
=p
otably they are XML, YAML and JSON.
The URIs need to end with C<.xml>, C<.yml> and C<.json> for XML, YAML and JSON, respectively.
=over
=item B<GET> I</nlp/models.(json|xml|yml)>
Returns an array
strings.
=item B<GET> I</nlp/languages.(json|xml|yml)>
Returns an array of supported languages. Default is "en" for English.
=item B<GET> I</nlp/info.(json|xml|yml)>
Returns a hashref of details
T> I</nlp/relations.(json|xml|yml)>
The user can get a list of all the english grammatical relations supported by
the NLP backend.
=item B<GET/POST> I</nlp/parse/B<$model>.(json|xml|yml)>
The user