Group
Extension

Matches 2

Gearman-Driver ( P/PL/PLU/Gearman-Driver-0.02007.tar.gz, PLU, 2012; MetaCPAN )
Gearman-Driver/lib/Gearman/Driver.pm ( view source; MetaCPAN )
el free to setup your C<$driver>
this way:

    package My::Workers::One;

    use Moose;
    use JSON::XS;
    extends 'Gearman::Driver::Worker::Base';

    # this method will be registered with gear
ode_json {
        my ( $self, $result ) = @_;
        return JSON::XS::encode_json($result);
    }

    sub decode_json {
        my ( $self, $workload ) = @_;
        return JSON::XS::decode_json($w
_method_by_name($method)->body,
                        decode => 'decode_json',
                        encode => 'encode_json',
                        name   => $method,
                    },
    
Gearman-Driver ( P/PL/PLU/Gearman-Driver-0.02007.tar.gz, PLU, 2012; MetaCPAN )
Gearman-Driver/lib/Gearman/Driver/Worker.pm ( view source; MetaCPAN )
method will be returned to the Gearman
client. This is useful to serialize Perl datastructures to JSON
before sending them back to the client.

    sub do_some_job : Job : Encode : Decode {
        my
ad ) = @_;
        return { message => 'OK', status => 1 };

        # calls 'encode' and returns JSON string: {"status":1,"message":"OK"}
    }

    sub custom_encoder : Job : Encode(enc_yaml) : Deco
lf, $result ) = @_;
        return JSON::XS::encode_json($result);
    }

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

    sub enc_yam

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.