POE::C...nector(3pm)

πŸ“¦
version 6.95 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– POE::Component::IRC::Plugin::Connector πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's serving POE::C...nector(3pm) energy. It's a PoCo-IRC plugin that handles the messy business of staying connected to an IRC server. Yes, that's the actual job. Being the friend who makes sure the group chat doesn't die. 🫢


✨ NAME ✨

POE::Component::IRC::Plugin::Connector β€” a PoCo-IRC plugin that deals with the messy business of staying connected to an IRC server. Like, the clingy-but-healthy kind of plugin. It keeps your bot online. Periodt. πŸ’…


🌸 SYNOPSIS 🌸

use POE qw(Component::IRC Component::IRC::Plugin::Connector);

my $irc = POE::Component::IRC->spawn();

POE::Session->create(
    package_states => [
        main => [ qw(_start lag_o_meter) ],
    ],
);

$poe_kernel->run();

sub _start {
    my ($kernel, $heap) = @_[KERNEL ,HEAP];
    $irc->yield( register => 'all' );

    $heap->{connector} = POE::Component::IRC::Plugin::Connector->new();

    $irc->plugin_add( 'Connector' => $heap->{connector} );

    $irc->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );

    $kernel->delay( 'lag_o_meter' => 60 );
    return;
}

sub lag_o_meter {
    my ($kernel,$heap) = @_[KERNEL,HEAP];
    print 'Time: ' . time() . ' Lag: ' . $heap->{connector}->lag() . "\n";
    $kernel->delay( 'lag_o_meter' => 60 );
    return;
}

look at her go β€” spawn the IRC component, register everything, bolt the Connector plugin on with plugin_add, connect, and then just vibe with a lag_o_meter loop every 60 seconds printing the lag. iconic behavior honestly. 🌈


πŸ¦‹ DESCRIPTION πŸ¦‹

POE::Component::IRC::Plugin::Connector is a POE::Component::IRC plugin whose whole entire personality is making sure your IRC bot stays connected to the IRC network of your choice. It implements the general algorithm as demonstrated over at http://poe.perl.org/?POE_Cookbook/IRC_Bot_Reconnecting.

tl;dr: the bot drops, the bot comes back. no cap. ✨


πŸŽ€ METHODS πŸŽ€

πŸ’œ new

Takes some optional arguments:

  • 'delay' β€” the frequency, in seconds, at which the plugin will ping the IRC server. Defaults to 300.
  • 'reconnect' β€” the time in seconds to wait before trying to reconnect to the server. Defaults to 60.
  • 'servers' β€” an array reference of IRC servers to consider. Each element should be an array reference containing a server host and (optionally) a port number. The plugin will cycle through this list of servers whenever it reconnects.
not the doc saying "two optional arguments" and then listing three πŸ™ˆ the count is not counting, bestie. The facts are still the facts: delay is 300 by default, reconnect is 60 by default, and servers is that array-of-array-refs rotation situation so you never get stuck on one dead host. πŸ”₯

Returns a plugin object suitable for use in POE::Component::IRC's "plugin_add" method. Slay. πŸ‘‘

⭐ lag

Returns the current 'lag' in seconds between sending PINGs to the IRC server and getting PONG responses.

Probably not likely to be wholely accurate. πŸ’€ yeah, she said it, not me β€” that's straight from the source. cute number, do not cite it in your thesis. 😭

πŸ‘‘ AUTHOR πŸ‘‘

Chris "BinGOs" Williams <chris@bingosnet.co.uk> β€” the actual legend behind all this. We stan. πŸ’–


🌟 SEE ALSO 🌟

  • POE::Component::IRC
  • POE::Component::IRC::Plugin

okay that's the whole page, and for the cute sign-off: this is perl v5.40.1, dated 2025-08-21, footer credit goes to POE::C...nector(3pm). go keep your bot online, bestie. you got this πŸ’…βœ¨

πŸ“¦ where this page comes from