NAME
POE::Component::IRC::Cookbook::Disconnecting - How to disconnect gracefully with PoCo-IRC
SYNOPSIS
Shutting down an IRC bot can be quick and messy, or slow and graceful.
DESCRIPTION
There are two ways you can shut down an IRC bot/client. The quick and dirty way is rather simple:
exit;
It exits the program, shutting down the socket, and everybody online sees yet another "Connection reset by peer" or "Remote end closed the socket" or something.
There's a little dance you can do to send a quit message and log out gracefully. It goes like this:
If you're logged in to an IRC server, send the
quit
command with your quit message and wait for anirc_disconnected
event to come back.Do either of the following:
Unregister all events. This is like the
register => 'all'
you probably posted near theconnect
command, but replaceregister
withunregister
. Once POE::Component::IRC knows your session isn't interested, it lets you go and things shut down.If your session is the last/only one using this IRC component, you can post a
shutdown
event to it. It will take care of unregistering all events.
AUTHOR
Rocco Caputo (I think). PODified by Hinrik Örn Sigurðsson.