Hyungsuk Hong > AnyEvent-MyPeopleBot-Client-0.0.2 > AnyEvent::MyPeopleBot::Client

Download:
AnyEvent-MyPeopleBot-Client-0.0.2.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.0.2   Source  

NAME ^

AnyEvent::MyPeopleBot::Client

VERSION ^

version 0.0.2

SYNOPSIS ^

    use AnyEvent::HTTPD;
    use AnyEvent::Mepeople::Client;
    my $client = AnyEvent::MyPeopleBot::Client->new(
        apikey => 'xxxx',
    );

    my $httpd = AnyEvent::HTTPD->new(port => 8080);
    $httpd->reg_cb(
        '/' => sub {
            my $action  = $req->parm('action');
            my $buddyId = $req->parm('buddyId');
            my $groupId = $req->parm('groupId');
            my $content = $req->parm('content');

            $req->respond({ content => [ 'text/plain', "AnyEvent::MyPeopleBot::Client" ]});
            if ($action =~ /^sendFrom/) {
                $client->send($buddyId || $groupId, 'hi', sub {
                    my $json = shift;
                    print "$json\n";
                });
            }
        }
    );

    $httpd->run;

AUTHOR ^

Hyungsuk Hong <hshong@perl.kr>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Hyungsuk Hong.

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: