y) {
return ($rows, $additional);
}
else {
return $rows;
}
}
use JSON::MaybeXS qw( decode_json encode_json );
use YAML::Any qw( LoadFile Load );
sub normalize_input {
my ($proto) = @_
ame;
<$fh>;
};
return @{decode_json($data)};
}
sub save_topograph {
my ($array, $filename) = @_;
open my $fh, '>', $filename;
print $fh encode_json($array);
close $fh;
}
1;
__END__
TION
The specification can be passed along as a filename that contains YAML or JSON,
a string that contains YAML or JSON, or as a hash of arrays of hashes. The
structure should look like:
{
Re
datetime
timestamp
year
))},
#unknown => {( map { $_ => 1 } qw(
# enum set bit json
# geometry point linestring polygon
# multipoint multilinestring multipolygon geometrycolle
1 if ! grep {
! exists $self->spec->{$_}
} $r->self_fk_cols;
}
return;
}
sub make_jsonable {
my $self = shift;
my ($item) = @_;
# Deference all scalar references. This happens w
R'
? ${$item->{$_}} : $item->{$_}
for keys %{$item};
# Stringify everything, otherwise JSON::MaybeXS gets confused
$item->{$_} = defined $item->{$_}
? '' . $item->{$_} : undef
for
$self->{trace}{find} = $self->{runner}{ids}{find}++;
$self->{trace}{row} = $self->make_jsonable( { $row->get_columns } );
$self->{trace}{criteria} = [$to_find];
$self->{trace}{u
if ( $self->{object_trace} ) {
use JSON::MaybeXS qw( encode_json );
open my $fh, '>', $self->{object_trace};
print $fh encode_json({
objects => $self->{traces},
our hardest to write out in JSON. If that doesn't work, write it
# out in DDP.
try {
use JSON::MaybeXS qw( encode_json );
print $fh encode_json({
objects => $sel
%x = ( objects => $self->{traces} );
print $fh np(%x);
warn "Couldn't write out in JSON ($e2). Using DDP instead\n";
};
close $fh;
}
die $e;
};
}
1;
__END__