… | |
… | |
4 | |
4 | |
5 | This is a tutorial about how to get the swing of the new L<AnyEvent::MP> |
5 | This is a tutorial about how to get the swing of the new L<AnyEvent::MP> |
6 | module, which allows us to transparently pass messages to our own process |
6 | module, which allows us to transparently pass messages to our own process |
7 | and to other processes on another or the same host. |
7 | and to other processes on another or the same host. |
8 | |
8 | |
9 | What kind of messages? Well, basically a message here means a list of |
9 | What kind of messages? Well, basically a message here means a list of Perl |
10 | Perl strings, numbers, hashes and arrays, anythin everything that can be |
10 | strings, numbers, hashes and arrays, anything that can be expressed as a |
11 | expressed as a L<JSON> text (as JSON is used by default in the protocol). |
11 | L<JSON> text (as JSON is used by default in the protocol). |
12 | |
12 | |
13 | And next you might ask: between which entities are those messages |
13 | And next you might ask: between which entities are those messages being |
14 | being "passed"? Effectively between I<nodes>: a nodes is basically a |
14 | "passed"? Physically within or between I<nodes>: a nodes is basically a |
15 | process/program that use L<AnyEvent::MP> and can run either on the same or |
15 | process/program that use L<AnyEvent::MP> and can run either on the same or |
16 | different hosts. |
16 | different hosts. |
17 | |
17 | |
18 | To make this more managable, every node can contain any number of |
18 | To make this more managable, every node can contain any number of |
19 | I<ports>: Ports are ultimately the receivers of your messages. |
19 | I<ports>: Ports are ultimately the receivers of your messages. |
20 | |
20 | |
21 | In this tutorial I'll show you how to write a simple chat server based |
21 | In this tutorial I'll show you how to write a simple chat server based |
22 | on L<AnyEvent::MP>. This example is used because it nicely shows how to |
22 | on L<AnyEvent::MP>. This example is used because it nicely shows how to |
23 | organise a simple application, but keep in mind that every node trusts any |
23 | organise a simple application, but keep in mind that every node trusts any |
24 | other, so this chat cannot be used to implement a real chat server and |
24 | other, so this chat cannot be used to implement a real chat server and |
25 | client system, but it can be used to implement a distributed chat system |
25 | client system, but it can be used to implement a distributed chat server |
26 | for example. |
26 | for example. |
27 | |
27 | |
28 | =head1 System Requirements and System Setup |
28 | =head1 System Requirements and System Setup |
29 | |
29 | |
30 | Before we can start we have to make sure some things work on your |
30 | Before we can start we have to make sure some things work on your |