POE::C...nector(3pm)
π 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 to300.'reconnect'β the time in seconds to wait before trying to reconnect to the server. Defaults to60.'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:delayis300by default,reconnectis60by default, andserversis 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::IRCPOE::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
- ubuntu resolute: libpoe-component-irc-perl 6.95+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpoe-component-irc-perl 6.95+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms