File: Disconnecting.pod

package info (click to toggle)
libpoe-component-irc-perl 6.35%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,520 kB
  • ctags: 1,061
  • sloc: perl: 14,612; sh: 48; makefile: 5
file content (61 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
=encoding utf8

=head1 NAME

POE::Component::IRC::Cookbook::Disconnecting - How to disconnect gracefully
with PoCo-IRC

=head1 SYNOPSIS

Shutting down an IRC bot can be quick and messy, or slow and graceful. 

=head1 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: 

=over

=item *

Send the C<QUIT> command to the IRC server, with your quit message. 

=item *

Wait for C<irc_disconnected> to come back.

=item *

Do either of the following:

=over

=item *

Unregister all events. This is like the C<< register => 'all' >> you probably
posted near the C<connect> command, but replace C<register> with C<unregister>.
Once POE::Component::IRC knows your session isn't interested, it lets you go
and things shut down. 

=item *

If your session is the last/only one using this IRC component, you can call
C<< $irc->yield('shutdown') >>. It will take care of unregistering all events.

=back

=back

=head1 AUTHOR

Rocco Caputo (I think). PODified by Hinrik E<Ouml>rn SigurE<eth>sson.