date({ workflow_instance_id => $rel->id });
$guard->commit;
return $self;
}
sub TO_JSON {
my $self = shift;
my $fields = {
map { $_ => $self->$_() }
qw/inst
ocess_id instance_name created completed/
};
# $fields->{attributes} = [ map { $_->TO_JSON } $self->attributes_rs->all ];
return $fields;
}
__PACKAGE__->meta->make_immutable( inli
ConfigFinder;
use strict;
use warnings 'all';
use Cwd 'fastcwd';
our $CONFIGFILE = 'asp4-config.json';
sub config_path
{
my $path = $CONFIGFILE;
my $root = do { ($ENV{REMOTE_ADDR} || '') eq
en => $server->auto_open,
)
);
}
package JSTAPd::Server::Contents::contents;
use JSON::XS ();
sub AUTOLOAD {
my($class, $server, $req, $session, $args) = @_;
my $path = our $
if (ref($ret)) {
return Plack::Response->new(200, [ 'Content-Type' => 'application/json' ], JSON::XS->new->ascii->encode($ret) );
} else {
return Plack::Response->new(200, [ 'Co
age App::PipeFilter::JsonToYaml;
use Moose;
extends 'App::PipeFilter::Generic';
with qw(
App::PipeFilter::Role::Reader::Sysread
App::PipeFilter::Role::Input::Json
App::PipeFilter:
package App::PipeFilter::JsonEthernetToIp;
{
$App::PipeFilter::JsonEthernetToIp::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic::Json';
with 'App::PipeFilter::Role::Transform::Et
n and save
it to the database.
=head2 $Config
The ASP4 C<$Config> object is stored in a simple JSON format on disk, and accessible
everywhere within your entire ASP4 application as the global C<$Co
ample project to get things going.
In the C<data_connections.main> section of C<conf/asp4-config.json> you should have
something like this:
...
"main": {
"dsn": "DBI:mysql:d
rver;
use strict;
use warnings;
use AE;
use Data::Dumper;
use File::ShareDir;
use File::Spec;
use JSON::XS;
use HTTP::Request;
use LWP::UserAgent;
use Path::Class;
use Time::HiRes;
use Plack::App::Di
th, $req, $session);
$res ||= Plack::Response->new( 200, [ 'Content-Type' => 'application/json' ], '{msg:"ok"}' );
} elsif ($apiurl && $req->uri->path =~ /$apiurl/) {
# ajax reque
quest}->{requests} ];
$current->{pop_tap_request}->{cv}->send(
$self->json_response($stack)
);
}
} else {
# ajax request?
my $path =
文字列でも構いません。オブジェクトの場合は L<JSON::XS> にて JSON encode された結果が戻ります。
JSON::XS が使われるのが嫌な場合には、自前で文字列
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
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
kage App::PipeFilter::JsonToTsv;
use Moose;
extends 'App::PipeFilter::Generic';
with qw(
App::PipeFilter::Role::Reader::Sysread
App::PipeFilter::Role::Input::Json
App::PipeFilter:
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__
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',
},
package App::PipeFilter::JsonIpToUdp;
{
$App::PipeFilter::JsonIpToUdp::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic::Json';
with 'App::PipeFilter::Role::Transform::IpToUdp';
1
#size => 255,
is_nullable => 1,
serializer_class => 'JSON',
},
class => {
data_type => 'VARCHAR',
size
s'
}
The return value can be any Perl construct. If it's a reference, the return value will be JSON encoded. Otherwise it will be passed as-is.
The C<server_api()> function takes the following par
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->$_ }
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;
serializer_class => 'JSON',
},
data_fields => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
input_sets
serializer_class => 'JSON',
},
output_sets => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
assignm
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
earch;
use Moose 1.00;
use URI 1.54;
use URI::QueryParam;
use Carp;
use LWP::UserAgent 5.835;
use JSON 2.21;
use Bing::Search::Response;
use vars qw($VERSION);
$VERSION = "0.0005";
$VERSION = eval $V
: $!";
}
my $j = JSON->new->decode( $response->content );
$self->_parse_json( $j );
}
sub _parse_json {
# Debugging!
use Data::Dumper;
my( $self, $json ) = @_;
my $resp = Bin
g::Search::Response->new( data => $json );
$self->response( $resp );
}
sub _make_uri {
my ($self) = @_;
unless( $self->has_sources ) {
croak "No sources means no query, yo.";
}