ixtures.json' )
{
eval { require Data::Properties::JSON };
$test_data = Data::Properties::JSON->new(
properties_file => $config->web->application_root . '/etc/test_fixtures.json'
)
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
= sub { $args{$param}->TO_JSON; } };
eval { $params->{$param} = delete($args{$param})->TO_JSON; };
if($@) {
throw_param error => "Could not jsonize $param: $@";
$val = $self->next::method(@args);
return bless $val, 'BPM::Engine::DateTime';
}
sub TO_JSON {
my($self, $level) = @_;
my %parms = map { $_ => $self->$_ } grep { $self->$_ }
);
## no critic (ProhibitMultiplePackages)
{
package BPM::Engine::DateTime;
use strict;
use warnings;
use parent 'DateTime';
sub TO_JSON {
my $dt = shift;
return "$dt";
}
}
1;
__END__
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__PACKAGE__->set_primary_key(qw/participant_id/);
__PACKAGE__->might_have(
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
my $field = (keys %{$type})[0];
my ($multi, $single) = @{ $type->{$field} };
my $json = '';
#warn "Storing field $field multi $multi single $single type $type container $conta
{
$json = delete $args->{$multi};
my @event_types = keys %{$json};
next unless scalar @event_types;
$json = scalar @event_types ? $json->{$event_types[
&& $args->{$multi}->{$single}) {
$json = delete $args->{$multi}->{$single};
delete $args->{$multi};
next unless $json->[0];
# get rid of XML::LibXML::E
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__PACKAGE__->set_primary_key(qw/ split_id /);
__PACKAGE__->belongs_to(
sor role for ProcessInstance and ActivityInstance
use namespace::autoclean;
use Moose::Role;
use JSON;
use BPM::Engine::Util::ExpressionEvaluator;
use BPM::Engine::Exceptions qw/throw_store throw_par
lue));
$init->{ScriptType} ||= '';
if($init->{ScriptType} eq 'json') {
$ivalue = decode_json($ivalue);
}
else {
$ivalue = $expr->render($iv
serializer_class => 'JSON',
},
formal_params => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
assignment
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
created =>
{process_name} ||= $attrs->{process_uid};
return $class->next::method($attrs);
}
sub TO_JSON {
my $self = shift;
my %params = map { $_ => $self->$_ } grep { $self->$_ }
qw/p
les => (
isa => 'ArrayRef',
is => 'rw',
auto_deref => 1,
);
sub TO_JSON {
my $self = shift;
my %ret;
for my $k (qw/id username password crypted_password hash
z;
use Moose;
use namespace::autoclean;
use LWP::UserAgent;
use DateTime;
use URI::Escape;
use JSON;
use Carp qw( croak );
use Digest::SHA qw( hmac_sha1_base64 );
use WWW::SEOmoz::URLMetric
uired';
my $res = $self->ua->get( $url );
if ( $res->is_success ) {
return from_json $res->content;
}
croak $res->content;
}
sub url_metrics {
my $self = shift;
m
#size => 255,
is_nullable => 1,
serializer_class => 'JSON',
},
class => {
data_type => 'VARCHAR',
size
ransit::Test::Example;
use strict;use warnings;
use Data::Dumper;
use IPC::Transit;
use POE;
use JSON;
use File::Slurp;
sub
import {
my $self = shift;
my ($callpack, $callfile, $callline) =
utes.json') or die "get_routes: routes.json not found\n";
my $routes;
eval {
$routes = decode_json($routes_text) or die "returned false\n";
};
die "get_routes: decode_json() fa
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
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',
},
);
package ASP4::Error;
use strict;
use warnings 'all';
use ASP4::HTTPContext;
use JSON::XS;
sub new
{
my $class = shift;
my ($err_str, %args);
if( @_ )
{
if( @_ == 1 )
{
$err_s
{stacktrace},
code => $code,
form_data => encode_json($Form) || "{}",
session_data => eval { encode_json(\%session_data) } || "{}",
http_referer => $ENV{HTTP_REFERER},
acktrace
A string - defaults to the value of C<$@>.
=head2 form_data
JSON-encoded C<$Form> object.
=head2 session_data
JSON-encoded C<$Session> object.
=head2 http_referer
Default value is C<$E
b} <=> $count->{$a} } keys %$count;
};
}
{
package Count;
use MooseX::POE;
use JSON::Any qw(XS);
with qw(MooseX::Workers);
my $rx = qr|GET /ongoing/When/\d\d\dx/(\d\d\d\d/\
nk) {
$count->{$1}++ if $line =~ $rx;
}
print JSON::Any->encode(
{ sender => $sender->ID, count => $count } );
}
r => 'loop' );
};
sub worker_stdout {
my ( $self, $out ) = @_;
my $msg = JSON::Any->decode($out);
POE::Kernel->post( $msg->{sender} => 'inc' => $msg->{count} );
}
=> Cow::Teeth->new,
);
And you want a hash containing some of those fields (perhaps to pass to
JSON::XS, or something). Then you can do this:
use Parse::FieldPath qw/extract_fields/;
my $cow_
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