HyeonSeung Kim > IPC-AnyEvent-Gearman-0.3 > IPC::AnyEvent::Gearman

Download:
IPC-AnyEvent-Gearman-0.3.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.3   Source   Latest Release: IPC-AnyEvent-Gearman-0.8

NAME ^

IPC::AnyEvent::Gearman - IPC through gearmand.

VERSION ^

version 0.3

SYNOPSIS ^

    use AnyEvent;
    use IPC::AnyEvent::Gearman;
    
    #receive    
    my $recv = IPC::AnyEvent::Gearman->new(servers=>['localhost:9999']);
    $recv->on_receive(sub{
        my $msg = shift;
        print "received msg : $data\n";
        return "OK";#result
    });
    $recv->listen();

    my $cv = AE::cv;
    $cv->recv;

    #send
    my $send = IPC::AnyEvent::Gearman->new(server=>['localhost:9999']);
    $send->pid(1102);
    my $result = $send->send("TEST DATA");

ATTRIBUTES ^

pid

'pid' is unique id for identifying each process. This can be any value not just PID. It is filled own PID by default.

servers

ArrayRef of hosts.

prefix

When register function, it uses prefix+pid as function name. It is filled 'IPC::AnyEvent::Gearman#' by default.

on_receive

on_receive Hander. First argument is DATA which is sent. This can be invoked after listen().

on_send

on_send handler. First argument is a channel string.

on_sendfail

on_sendfail handler. First argument is a channel string.

METHODS ^

listen

To receive message, you MUST call listen().

channel

get prefix+pid

send

To send data to process listening prefix+pid, use this. You must set 'pid' or 'prefix' attribute on new() method.

    my $send = IPC::AnyEvent::Gearman->new(pid=>1223);

AUTHOR ^

KHS, HyeonSeung Kim <sng2nara@hanmail.net>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by HyeonSeung Kim.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: