1 package APKPM::Gearman;
5 use Data::Dump qw(dump);
9 use DateTime::Format::Pg;
14 my ( $self, $result ) = @_;
15 warn "# e_json ", dump $result;
16 return $result unless ref $result; # FIXME report error?
17 return JSON::XS::encode_json($result);
21 my ( $self, $workload ) = @_;
22 warn "# d_json $workload";
23 return JSON::XS::decode_json($workload);
27 my ( $self, $result ) = @_;
28 warn "# d_array $result";
29 return [ split(/\s+/,$result) ];
34 return DateTime::Format::Pg->format_datetime( DateTime->now );
38 my ($self,$hash) = @_;
40 warn "# hash ",dump $hash;
41 local $Data::Dumper::Useqq = 1; # double quote for PostgreSQL
42 my $h = Dumper($hash);
44 $h =~ s/^\$\w+\s*=\s*{\s*//s;
45 $h =~ s/\s*}\s*;\s*$//s;