Commit 2e039566 by PotatoGim

gearman: client 예제

parent b71419d6
#!/usr/bin/env perl
#===========================================================================
# FILE: client.pl
# USAGE: ./client.pl
# DESCRIPTION:
# VERSION: 0.01
# OPTIONS: ---
# NOTES: ---
# AUTHOR: cpan:potatogim <potatogim@potatogim.net>
# COPYRIGHT: Copyleft(c) 2016 by cpan:potatogim.
# LICENSE: Artistic License 2.0
# DATE: 2016년 12월 12일 18시 03분 48초
#===========================================================================
use strict;
use warnings;
use utf8;
use Gearman::XS qw/:constants/;
use Gearman::XS::Client;
use Storable qw/freeze/;
my $client = Gearman::XS::Client->new();
my $ret = $client->add_server('127.0.0,1', 7003);
my $tasks = $client->new_task_set();
my $handle = $tasks->add_task(
sum => freeze( [ 3, 5 ] ),
{
on_complete => sub { print ${ $_[0] }, "\n"; }
}
);
=encoding utf8
=head1 NAME
client.pl -
=head1 SYNOPSIS
=head1 DESCRIPTION
=head1 AUTHOR
cpan:potatogim E<lt>potatogim@potatogim.netE<gt>
=head1 CONTRIBUTORS
=head1 COPYRIGHT AND LICENSE
Copyleft(c) 2016 by cpan:potatogim.
This is free software; you can redistribute it and/or modify it
under the same terms as Perl 5 itself at:
L<http://www.perlfoundation.org/artistic_license_2_0>
You may obtain a copy of the full license at:
L<http://www.perl.com/perl/misc/Artistic.html>
=head1 SEE ALSO
=head1 DATE
2016년 12월 12일 18시 03분 48초
=cut
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment