use Data::Dump qw(dump);
with 'APKPM::Config';
+with 'APKPM::Gearman::Client';
use lib '/opt/managment_tools/lib';
use H1::Davolink;
$ret->{UPTIME} = $cpeconnect->custom("cat /proc/uptime");
} elsif ( $param =~ m/adsl/i ) {
$ret->{ADSL} = { $cpeconnect->adsl_info };
+ $self->do_background_json( 'Store_ADSL', $ret );
} elsif ( $param =~ m/wan/i ) {
$ret->{WAN} = [ $cpeconnect->wan_info ];
} elsif ( $param =~ m/route/i ) {
--- /dev/null
+package APKPM::Gearman::Client;
+
+use Moose::Role;
+
+use Gearman::Client;
+use JSON::XS;
+
+has gc => (
+ is => 'ro',
+ default => sub {
+ my $self = shift;
+ my $gc = Gearman::Client->new;
+ $gc->job_servers( $self->server );
+ $gc;
+ },
+);
+
+sub do_background_json {
+ my ( $self, $func, $args ) = @_;
+ $self->gc->dispatch_background( $func, JSON::XS::encode_json($args) );
+}
+
+1;