| 1 |
=encoding utf8 |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
POE::Component::IRC::Cookbook::Disconnecting - How to disconnect gracefully |
| 6 |
with PoCo-IRC |
| 7 |
|
| 8 |
=head1 SYNOPSIS |
| 9 |
|
| 10 |
Shutting down an IRC bot can be quick and messy, or slow and graceful. |
| 11 |
|
| 12 |
=head1 DESCRIPTION |
| 13 |
|
| 14 |
There are two ways you can shut down an IRC bot/client. The quick and dirty way |
| 15 |
is rather simple: |
| 16 |
|
| 17 |
exit; |
| 18 |
|
| 19 |
It exits the program, shutting down the socket, and everybody online sees yet |
| 20 |
another "Connection reset by peer" or "Remote end closed the socket" or |
| 21 |
something. |
| 22 |
|
| 23 |
As of version 6.50, all you need to do in order to shut down gracefully is to |
| 24 |
send a L<C<shutdown>|POE::Component::IRC/shutdown> event to the IRC component. |
| 25 |
It will make sure your quit message (if any) gets delivered, and will forcibly |
| 26 |
disconnect if there are any problems (faulty server or network issues). After |
| 27 |
doing this, it will unregister all sessions and clean up after itself. |
| 28 |
|
| 29 |
If you want to do something more elaborate on your own, take a look at |
| 30 |
the following documentation: L<logged in|POE::Component::IRC/logged_in>, |
| 31 |
L<C<connected>|POE::Component::IRC/connected>, |
| 32 |
L<C<quit>|POE::Component::IRC/quit>, |
| 33 |
L<C<disconnect>|POE::Component::IRC/disconnect>, and |
| 34 |
L<C<unregister>|POE::Component::IRC/unregister>. |
| 35 |
|
| 36 |
=head1 AUTHOR |
| 37 |
|
| 38 |
Rocco Caputo and Hinrik E<Ouml>rn SigurE<eth>sson. |
| 39 |
|