sh, l.direction
order by l.language_code
| )->hashes;
$self->render( json => $list );
}
Or:
sub list {
my $self = shift;
my $list = $self->db( 'a
from audio.reciter r
order by r.english
| )->hashes;
$self->render( json => $list );
}
This module uses L<Nour::Database> which is a wrapper for L<DBIx::Simple> to p
, namespace => decamelize( ref $app ) .':'. $app->mode
, serializer => { serializer => 'JSON::XS', compress => 1 }
};
$app->attr( __chi => sub {
return new CHI ( %{ $opts->{
ace => decamelize( ref $self ) .':'. $self->mode
, serializer => { serializer => 'JSON::XS', compress => 1 }
}
} );
}
then
package App::Example;
use M
me_results;
return $res;
}, expires_in => 60 );
return $self->render( json => { res1 => $res1, res3 => $res3, also_res1 => $also_res1, res2 => $res2 } );
}
See L<CHI>
Md2Inao') }) {
if (-d $dir) {
$self->load_filter_config(path($dir, 'id_filter.json'));
last;
}
}
return $self;
}
sub prepend_metadata {
my ($self,
ai::Open::DiagnosticTools::VERSION = '0.02';
use strict;
use warnings;
use v5.10;
use Moose;
use JSON;
#XXX create a useful scheme for REST methods
use constant {
TOOLS_URI => '/diagnostic-tool
(sprintf('HTTP response code for dig() call is %s', $self->response->code()));
$data = decode_json($self->response->content());
given($self->response->code()) {
when($_ == 200) {
(sprintf('HTTP response code for mtr() call is %s', $self->response->code()));
$data = decode_json($self->response->content());
given($self->response->code()) {
when($_ == 200) {
WWW::Jawbone::Up::Score::Move;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_accessors(
qw(distance active_time longest_active longest_idle));
__PACKAGE
age WWW::Jawbone::Up::Workout;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_accessors(qw(title), { complete => 'is_complete' });
__PACKAGE__->add_time_a
ackage WWW::Jawbone::Up::Feed;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
use DateTime;
__PACKAGE__->add_accessors(
qw(title date type reached_goal), {
timezone
d2Inao::Builder;
use utf8;
use strict;
use warnings;
use Class::Accessor::Fast qw/antlers/;
use JSON;
use Path::Tiny;
has dispatch_table => ( is => 'rw' );
has before_filter_config => ( is => 'rw
ult};
}
sub load_filter_config {
my ($self, $path) = @_;
my $json = path($path)->slurp;
my $config = decode_json $json;
for (qw/before_filter after_filter/) {
if ($config->{$_
ackage WWW::Jawbone::Up::User;
use 5.010;
use strict;
use warnings;
use base 'WWW::Jawbone::Up::JSON';
__PACKAGE__->add_accessors(
qw(first last name short_name), {
friend => 'user_is_friend'
ocket::SSL 1.981
LWP::Protocol::https 6.04
common::sense 3.72
Types::Serialiser 1.0
JSON::XS 3.01
JSON 2.90
Metabase::Client::Simple 0.009
Data::UUID 1.219
Data::GUID 0.048
CPAN::Distn
SPATCH' => sub {
$_[0]->{chrome_logger} = Web::ChromeLogger->new(
json_encoder => $conf->{json_encoder},
);
});
$c->add_trigger('AFTER_DISPATCH' => sub {
$
By default, this plugin is disabled under PLACK_ENV:production environment.
=head2 json_encoder
You can pass C<json_encoder> to L<WEB::ChromeLogger>.
=head1 REPOSITORY
Amon2::Plugin::Web::ChromeL
oo = ( bar => 'baz' );
$self->debug( "foo", "bar", "baz", \%foo );
$self->render( json => [] );
}
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee d
kachan;
use 5.008005;
use strict;
use warnings;
use Encode qw/encode_utf8/;
use Getopt::Long;
use JSON;
use Log::Minimal;
use LWP::UserAgent;
use Plack::Builder;
use Plack::Runner;
use Plack::Request;
pe' => 'text/plain', 'Content-Length' => 18], ['Payload is nothing']];
}
my $dat = decode_json($payload);
if ($self->{debug}) {
infof("Payload: %s", $payload);
}
my $even
TTP request and Leyland response
use Moo;
use namespace::clean;
use Carp;
use Data::Dumper;
use JSON;
use Leyland::Exception;
use Leyland::Logger;
use Module::Load;
use Text::SpanningTable;
use Try:
nvenience. You will use the C<set_user()> method
to set the value of this attribute.
=head2 json
A L<JSON::Any> object for usage by routes as they see fit.
=head2 xml
An L<XML::TreePP> object for
eq 'Leyland::Logger' }
);
has 'json' => (
is => 'ro',
isa => sub { die "json must be a JSON object" unless ref $_[0] && ref $_[0] eq 'JSON' },
default => sub { JSON->new->utf8(0)->convert_blessed
=> eval {
return 0 if HAVE_HTTP_TINY; # unnecessary
require LWP::UserAgent; 1;
};
use JSON::PP;
use constant ENDPOINT_URL => 'https://api.pushover.net';
use constant HTTP_TIMEOUT => 1
my $res = $self->_http_get( ENDPOINT_URL . '/1/sounds.json?token=' . $self->{token} );
if ( $res->{success} ) {
my $data = $self->_json_parser->decode($res->{content});
my @sounds
Sounds API is failed.";
}
}
# JSON Parser accessor
sub _json_parser {
my $self = shift;
$self->{json_parser} ||= JSON::PP->new();
return $self->{json_parser};
}
# Browser accessor
su
layouts/ (required)
|----------- main.html (required)
|----- i18n/
|-------- es.json
|-------- he_and_it.coll.json
The C<app.psgi> file is a standard L<PSGI> application that configures and
initi
ews and templates reside. These will
mostly be HTML templates, but can actually be anything, even JSON or XML
or whatever. Views and templates are handled by Leyland's view classes,
and are rendered a
irectory. Once again, this is optional and
purely a suggestion. If used, this directory will hold JSON localization
files for localizing your application with L<Locale::Wolowitz>. See
L<Leyland::Manua
=> eval {
return 0 if HAVE_HTTP_TINY; # unnecessary
require LWP::UserAgent; 1;
};
use JSON::PP;
use constant ENDPOINT_URL => 'https://api.pushover.net';
use constant HTTP_TIMEOUT => 1
my $res = $self->_http_get( ENDPOINT_URL . '/1/sounds.json?token=' . $self->{token} );
if ( $res->{success} ) {
my $data = $self->_json_parser->decode($res->{content});
my @sounds
Sounds API is failed.";
}
}
# JSON Parser accessor
sub _json_parser {
my $self = shift;
$self->{json_parser} ||= JSON::PP->new();
return $self->{json_parser};
}
# Browser accessor
su
s look at a pretty complete example:
get '^/posts$' accepts 'text/html|application/json' returns 'application/json' {
my @posts = MyDatabase->load_posts();
return { posts => \@posts };
}
The a
hat
has an empty prefix). It will only accept C<text/html> or C<application/json>
from the client, and will only return JSON. The following HTTP methods
are available:
=over
=item * get: for C<GET>
.
post '^/posts$' returns 'application/json' {
my @posts = $c->forward('GET:/posts');
# do stuff with @posts
}
get '^/posts$' returns 'application/json' is 'internal' {
return MyDatabase->l
e.
This is why I created L<Locale::Wolowitz>, which is a very simple localization
system based on JSON. This is also the reason why, as opposed to logging
and view classes, Leyland only provides C<Loc
new; # = MyLeylandApp
=item * Leyland no longer uses L<JSON::Any> as its JSON object. It now uses L<JSON> (which will automatically load L<JSON::XS> if available). The interface should be the same, b
robably should be aware of this change. Note, also, that C<convert_blessed> is now enabled on the JSON object.
=item * Leyland is now L<Moo>-based instead of L<Moose>-based, so it is much lighter tha