package APKPM;

use base qw(Gearman::Driver::Worker);
use Moose;
use Time::HiRes;
use JSON::XS;
use Data::Dump qw(dump);

our $VERSION = '0.00';

sub prefix { '' }

sub process_name {
	my ( $self, $orig, $job_name ) = @_;
	warn "# process_name $orig $job_name\n";
	return "$orig ($job_name)";
}

sub poll : Job : MinProcesses(1) : MaxProcesses(5) : Encode : Decode {
	my ( $self, $job, $workload ) = @_;
	warn "# poll $job ", dump($workload);
}

sub encode {
	my ( $self, $result ) = @_;
	warn "# encode ",dump $result;
	return JSON::XS::encode_json($result);
}

sub decode {
	my ( $self, $workload ) = @_;
	warn "# decode ", dump $workload;
	return JSON::XS::decode_json($workload);
}

1;
