oogle::Visualization::DataSource;
use strict;
use warnings;
use Moose;
use Clone qw/clone/;
use JSON::XS;
use Digest::MD5 qw/md5_hex/;
=head1 NAME
Data::Google::Visualization::DataSource - Google
tty pictures from your data. By design
it has a fair amount of Google-cruft, such as non-standard JSON and stuffing
configuration options in to a single CGI query parameter. It's also got somewhat
con
e_auth => $q->header('X-DataSource-Auth')
});
# Set it by hand...
->new({ reqId => 3, out => 'json', sig => 'deadbeef' });
C<new()> will set the following object attributes based on this, all bas
se Metabase::Fact;
use Carp ();
use Data::GUID ();
use Data::Stream::Bulk::Filter 0.08;
use JSON 2 ();
use Net::Amazon::S3;
use Path::Class ();
use Compress::Zlib 2 qw(compress uncompress);
wit
n $client->$method( name => $self->bucket );
}
);
has '_json' => (
is => 'ro',
required => 1,
lazy => 1,
default => sub { JSON->new->ascii },
);
sub initialize {}
# given fact, store it
store: no GUID set for fact\n";
}
my $json = $self->_json->encode($fact_struct);
if ( $self->compressed ) {
$json = compress($json);
}
my $s3_object = $self->s3_bucket-
Agent;
use HTTP::Request;
use HTTP::Headers;
use vars qw(
$AUTOLOAD
$VERSION
$JSON_ENCODE
$JSON_DECODE
$DEFAULT_RETRY_MAX
$DEFAULT_RETRY_INTERVAL
);
$VERSION = sprintf "%d.%03
sub serialize_type {
return shift->{'serialize_type'} ||=
eval { require JSON } ? 'json'
: eval { require YAML::Syck } ? 'yaml'
: eval { require YAML }
a::URIEncode } ? 'uri'
: die "Can't find a module that can encode and decode (need one of JSON, YAML::Syck, YAML, Data::URIEncode, XML::Simple)";
}
###----------------------------------------
er::Logger::ConsoleAggregator::VERSION = '0.005';
}
use Dancer::Hook;
use DateTime;
use JSON qw(to_json from_json);
use Try::Tiny;
use base 'Dancer::Logger::Abstract';
# ABSTRACT: Dancer Console Log
$obj = ref $ev_res ? $ev_res : undef;
};
try {
# If its json stringified
$obj = from_json($message);
} if !$obj;
# If its just a string
push( @$strings, $m
ERR _to_json($log_message) ."\n";
}
($log_message, $strings) = ({}, []);
}
sub init {
Dancer::Hook->new( 'after', sub {
try { flush }
catch { print STDERR _to_json({ LOG_E
__PACKAGE__->VARS;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Date 'time2iso';
use JSON::XS;
use Data::Dumper;
require ASP4;
our $ua;
sub run
{
my ($s, $context) = @_;
my $erro
ndler::Remote - Send your errors someplace else via http.
=head1 SYNOPSIS
In your C<asp4-config.json>:
...
"errors": {
"error_handler": "ASP4::ErrorHandler::Remote",
"post_erro
e XML::Twig;
use Data::SCORM::Organization;
use Data::SCORM::Item;
use Data::SCORM::Resource;
use JSON::Any;
use Data::Dumper;
=head1 NAME
Data::SCORM::Manifest - represent the Manifest
=head1 SYN
rn $class->new(%data);
}
sub as_hoh {
# turn this into a normal perl data structure that we can jsonnify
my ($self, $url_base) = @_;
$url_base ||= '';
my %organizations = map {
my $org_name =
zations,
};
}
sub to_json {
my $self = shift;
my $hoh = $self->as_hoh(@_); # e.g. the $url_base param
my $js = JSON::Any->new( allow_blessed => 1 );
return $js->to_json($hoh);
}
# __PACKAGE__
use this log module. Then you can debug like this:
debug { field1 => "data" };
debug to_json({ field2 => "data" });
debug "Raw Data";
And this module will log something like this:
::DataSource::VERSION = '0.01';
}
use strict;
use warnings;
use Moose;
use Clone qw/clone/;
use JSON::XS;
use Digest::MD5 qw/md5_hex/;
=head1 NAME
Data::Google::Visualization::DataSource - Google
tty pictures from your data. By design
it has a fair amount of Google-cruft, such as non-standard JSON and stuffing
configuration options in to a single CGI query parameter. It's also got somewhat
con
e_auth => $q->header('X-DataSource-Auth')
});
# Set it by hand...
->new({ reqId => 3, out => 'json', sig => 'deadbeef' });
C<new()> will set the following object attributes based on this, all bas
use strict;
use warnings 'all';
use base 'ASP4::SessionStateManager';
use Cache::Memcached;
use JSON::XS;
my $memd;
sub new
{
my ($class, $r) = @_;
my $s = bless { }, $class;
my $conn = ASP4
ion_id
{
my ($s, $id) = @_;
my $ref = $memd->get( $id )
or return;
$s = bless decode_json($ref), ref($s) ? ref($s) : $s;
}# end verify_session_id()
*retrieve = \&verify_session_id;
sub
$s->{__lastMod} = time();
$s->sign;
my %clone = %$s;
my $json = encode_json(\%clone);
$memd->set( $s->{SessionID}, $json, $s->{__ttl} );
}# end save()
sub reset
{
my $s = shift;
use Compress::Zlib 2 qw(compress uncompress);
use Data::Stream::Bulk::Callback;
use JSON 2 qw/encode_json decode_json/;
use Metabase::Fact;
use Try::Tiny;
use Moose;
with 'Metabase::Backend::MongoD
o GUID set for fact\n";
}
my $json = compress(encode_json($fact_struct));
# g for guid; d for data
$self->coll->insert( { g => $guid, d => $json }, {safe => 1} );
return $guid;
:Cursor::slave_okay = 1;
my $obj = $self->coll->find_one( { g => $guid } );
return decode_json(uncompress($obj->{d}));
}
# DO NOT lc() GUID
sub delete {
my ( $self, $guid ) = @_;
retu
hex );
use English qw( -no_match_vars );
use File::Slurp qw( read_file write_file read_dir );
use JSON;
use Params::Validate qw( :all );
use Storable;
use YAML::Syck qw( LoadFile DumpFile );
=encodin
ails, it will try to use I<JSON> to load the data.
This method supports reading I<.12> and I<.13> file formats.
It can auto-detect if it was serialized with storable or JSON.
=cut
sub read_db_file {
# Data is a Storable image.
return retrieve($file_path);
}
require JSON;
return decode_json( $data );
} # }}}
1;
=back
=head1 LICENCE
Copyright 2009-2011, Bartłomiej Sygu
e::autoclean;
use LWP::UserAgent;
use Net::CoverArtArchive::CoverArt;
use JSON::Any;
has json => (
default => sub { JSON::Any->new( utf8 => 1 ) },
lazy => 1,
is => 'ro'
);
has lwp => (
wp->get("$host/release/$release_mbid");
if ($res->is_success) {
my $index = $self->json->jsonToObj($res->decoded_content);
return [
map {
Net::CoverArt
<VirtualHost *:80>
...
PerlTransHandler ASP4x::Router
...
</VirtualHost>
% asp4-config.json
...
"web": {
...
"request_filters": [
...
{
"uri_match": "/.*",
...
]
...
"routes": [
{
"include_routes": "@ServerRoot@/conf/routes.json"
},
{
"name": "CreatePage",
"path": "/main/:type/create",
erally B<*thousands*> of different entries in the "C<routing>"
section of your C<conf/asp4-config.json> file, performance should be B<quite> fast.
=head2 Where can I learn more?
Please see the docum
onse->Redirect("/login/");
}# end if()
}
1;# return true:
Then, in your C<asp4-config.json>:
{
...
"web": {
...
"request_filters": [
{
"uri_match":
d ASC' })->search(@args);
}
sub TO_JSON {
my $rs = shift;
my @instances = ();
while(my $row = $rs->next) {
my $instance = $row->TO_JSON;
$instance->{uri} = '/wfcs/acti
serializer_class => 'JSON',
},
taskdata => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
taskresu
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
created => {
data_type => 'DATETIME',
is_nullable
b is_completed {
my $self = shift;
return $self->completed ? 1 : 0;
}
sub TO_JSON {
my ($self, $level) = @_;
my %struct = map { $_ => $self->$_ } grep { $self->$_ }
serializer_class => 'JSON',
},
actual_params => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
da
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
is_readonly => {
data_type => 'BOOLEAN', # synonym for TINYINT(1
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
is_serializable => 1,
},
);
__PACKAGE__->set_primary_key(qw/ process_ins
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__
serializer_class => 'JSON',
},
artifacts => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
extended
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__PACKAGE__->set_primary_key('package_id');
__PACKAGE__->uuid_columns('
);
#__PACKAGE__->many_to_many( package_transitions => 'processes', 'transitions' );
sub TO_JSON {
my $self = shift;
my %parms = map { $_ => $self->$_ } grep { $self->$_ }
qw/pa