Gearman...::Async(3)

πŸ“¦
version 0.94 Β· 2 versions
, in fedora 43

πŸ’– Gearman::Client::Async(3) πŸ’–

okay bestie, come closer β€” this is a page from the User Contributed Perl Documentation, and it's all about Gearman::Client::Async, the async client module for Gearman that you'd use inside Danga::Socket applications. πŸ¦‹


✨ NAME ✨

Gearman::Client::Async β€” the asynchronous client module for Gearman, made for Danga::Socket applications. no cap, that's literally it. πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, copy-paste ready, not a single character changed bestie:

use Gearman::Client::Async;

# Instantiate a new Gearman::Client::Async object.
$client = Gearman::Client::Async->new(
    job_servers => [ '127.0.0.1', '192.168.0.1:123' ],
);

# Overwrite job server list with a new one.
$client->set_job_servers( '10.0.0.1' );

# Read list of job servers out of the client.
$arrayref = $client->job_servers;
@array = $client->job_servers;

# Start a task
$task = Gearman::Task->new(...); # with callbacks, etc
$client->add_task( $task );

let me walk you through it because the way this is giving main character energy: πŸŽ€

  • use Gearman::Client::Async; β€” first things first, you gotta actually load the module. πŸ™ˆ
  • $client = Gearman::Client::Async->new(...) β€” instantiate a brand new Gearman::Client::Async object, and pass it your job_servers, which is an arrayref of servers like '127.0.0.1' and '192.168.0.1:123'. yes, ports are allowed, slay. πŸ”₯
  • $client->set_job_servers( '10.0.0.1' ); β€” overwrite the job server list with a whole new one. bye old servers. πŸ’€
  • $arrayref = $client->job_servers; β€” read the list of job servers out of the client. list context gets you an array, scalar context gets you the arrayref. both. iconic. πŸ‘‘
  • @array = $client->job_servers; β€” same call, list context edition. obsessed.
  • $task = Gearman::Task->new(...); β€” start a task, with callbacks and everything (that ... is doing a lot of heavy lifting, iykyk).
  • $client->add_task( $task ); β€” and then you add the task to the client. that's the whole async moment. ✨

Copyright 2006 Six Apart, Ltd.

License granted to use/distribute under the same terms as Perl itself. 🫢 (yes that's the real license line, verbatim, because we don't mess with legal text, fr fr)


πŸ’œ WARRANTY πŸ’œ

This is free software. This comes with no warranty whatsoever. 😭

bestie. read that again. free as in free, but zero warranty, not even a little one. it's giving "you're on your own and we love that for you". πŸ’…

⭐ AUTHORS ⭐

the literal legends who made this:

  • Brad Fitzpatrick (brad@danga.com)
  • Jonathan Steinert (hachi@cpan.org)

and that's the whole page, no skips, no summaries, every single detail intact because that's just how we do it here. 🧚

this was brought to you by perl v5.42.0, dated 2025-07-25, straight outta the User Contributed Perl Documentation. πŸ’– bye bestie, go write some async tasks ✨ πŸ¦‹

πŸ“¦ where this page comes from