ttyTrace - Pretty Tracing DebugObj
=head1 SYNOPSIS
DBIC_TRACE_PROFILE=~/dbic.json perl -Ilib ./foo.pl
Where dbic.json contains:
{
"profile":"console",
"show_progress":1,
"squash_repeats
header && $header eq 'XMLHttpRequest' ) {
$self->app->log->debug( "AJAX / JSON Response triggered!" );
$self->render_json({
dyncontent => $self->stash( 'content' ),
headline => $self->stash(
$msg = $client->res->code." ".$client->res->default_message;
my $got = $client->res->json;
if ($got && ref $got eq 'HASH' and keys %$got==1 && $got->{text}) {
$msg = $client->res->code." ".$client->res->default_message;
my $got = $client->res->json;
if ($got && ref $got eq 'HASH' and keys %$got==1 && $got->{text}) {
package Catalyst::Action::Serialize::JSONP;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Action::Serialize::JSON';
our $VERSION = '1.06';
$VERSION = eval $VERSION;
after 'execute' => sub
.$c->res->output().');');
} else {
warn 'Callback: '.$callback_value.' will not generate valid Javascript. Falling back to JSON output';
}
}
};
__PACKAGE__->meta->make_immutable;
1;
IS
tracks.pm :
package Tracks;
use Clustericious::Client;
route 'mixes' => '/mixes.json';
route_doc mixes => 'Get a list of mixes.';
route_args mixes => [
{ name => 'api
to
a data structure if it is application/json.
=cut
use Mojo::Base qw/-base/;
use Mojo::UserAgent;
use Mojo::ByteStream qw/b/;
use Mojo::Parameters;
use JSON::XS;
use Clustericious::Config;
use Clu
erence is passed, the method changes to POST and the hash is
encoded into the body as application/json.
=item modifies_payload, key
Describes how the parameter modifies the payload.
'hash' means se
head1 SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON', 'io' => 'File');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'In
methods to load/store a class
## on the file system
$p->store('my_point.json');
my $p2 = Point->load('my_point.json');
=head1 METHODS
=over 4
=item B<load ($filename)>
=item B<store ($file
d, col_int, col_text, col_real FROM datatable', [qw{id col_int col_text col_real}] );
$c->render( json => $res );
=cut
sub new {
my $class = shift;
my $self = {};
$self = {@_};
die("Undefined
TP::Request->new( 'POST', $server);
my $ua = new LWP::UserAgent;
my $cheader = 'application/xdi+json';
if ($context) {
$cheader .= ';contexts=1';
}
$request->header('accept' => $cheader);
$req
", $response->status_line;
return undef;
}
}
sub _xdi_response {
my ($json) = @_;
my $struct = XDI::_decode($json);
if (defined $struct) {
my $tuple = XDI::pick_xdi_tuple($struct,['$false$
is a JSON encoded representation of the nodes requested in the $get operation. Other
operations will return an empty hash {} upon success. Default behavior is to automatically convert
the JSON to a
ilename => 'logfile'
)
);
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable( 'LogDispatch', logger => $log );
=head1 AUTHOR
franck cuny <franck@lumb
VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('Runtime');
my $result = $client->public_timeline;
say "request e
ad1 SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON', 'io' => 'File');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => '
ION = '0.05';
use strict;
use warnings;
use Carp;
use Log::Log4perl qw(get_logger :levels);
use JSON::XS;
use Data::Dumper;
use Data::UUID;
use Storable qw(dclone);
use Clone qw(clone);
use XDI::Co
get_logger();
my $struct;
eval {
$struct = JSON::XS::->new->pretty(1)->decode($string);
};
if ($@ && not defined $struct) {
carp("Not a valid JSON string");
carp($@);
return undef;
} else
is a JSON encoded representation of the nodes requested in the $get operation. Other
operations will return an empty hash {} upon success. Default behavior is to automatically convert
the JSON to a
YAML string
$p->freeze();
# ----
# __CLASS__: "Point"
# x: 10
# y: 10
# unpack the JSON string into a class
my $p2 = Point->thaw(<<YAML);
----
__CLASS__: "Point"
x: 10
y: 10
ad1 SYNOPSIS
package Point;
use Moose;
use MooseX::Storage;
with Storage('format' => 'JSON', 'io' => 'File');
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => '
ad1 VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('api.json');
$client->enable(
'Auth::Header',
header_name => 'X-API-Auth',
hea
esponse;
use Any::Moose;
use WebService::Solr::Document;
use Data::Page;
use Data::Pageset;
use JSON::XS ();
has 'raw_response' => (
is => 'ro',
isa => 'Object',
handles => {
>raw_response->content;
return {} unless $content;
my $rv = eval { JSON::XS::decode_json( $content ) };
### JSON::XS throw an exception, but kills most of the content
### in the diagn
m * raw_response - the raw L<HTTP::Response> object.
=item * content - a hashref of deserialized JSON data from the response.
=item * docs - an array of L<WebService::Solr::Document> objects.
=item
package WWW::Foursquare::Response;
use strict;
use warnings;
use JSON;
our %ERROR_TYPE = (
invalid_auth => 'OAuth token was not provided or was invalid',
param_error => 'A re
elf, $class;
return $self;
}
sub process {
my ($self, $res) = @_;
my $data = decode_json($res->content());
my $code = $res->code();
# response is OK
return $data->{response}
=> 'ro',
isa => 'HashRef',
auto_deref => 1,
default => sub { { wt => 'json' } }
);
has 'last_response' => (
is => 'rw',
isa => 'Maybe[WebService::Solr::Response]'
{
$options->{ default_params }
= { %{ $options->{ default_params } }, wt => 'json', };
}
return $options;
}
sub add {
my ( $self, $doc, $params ) = @_;
my @docs
VERSION
version 0.05
=head1 SYNOPSIS
my $client = Net::HTTP::Spore->new_from_spec('twitter.json');
$client->enable('DoNotTrack');
=head1 DESCRIPTION
Add a header B<x-do-not-track> to your
age Mojolicious::Plugin::BlogSpam;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::URL;
use Mojo::JSON;
use Mojo::Log;
use Mojo::UserAgent;
use Scalar::Util 'weaken';
our $VERSION = '0.05';
# Todo:
$self->{log}) {
# Serialize comment
my $msg = "[$1]: " . ($2 || '') . ' ' .
Mojo::JSON->new->encode($self->hash);
# Log error
if ($1 eq 'ERROR') {
$log->error($msg);