fixed dummy values in Build.PL
[urisagit/Stem.git] / Cookbook / World1.pm
1 package World1;
2
3 # This is  class level cell with no constructor or alias registration.
4 # It has one simple command message handler
5
6 sub hello_cmd {
7
8     return "Hello world!\n";
9 }
10
11 =head1 Stem Cookbook - World1
12
13 =head1 NAME
14
15 World1 - A minimal class level B<Stem> cell.
16
17 =head1 DESCRIPTION
18
19 This is the simplest possible B<Stem> class level cell.  It contains a
20 single method named C<world_cmd>.  Because this method ends in C<_cmd>
21 it is capable of being invoked remotely via a command message and have
22 its return value sent back as a response message to the sender, which
23 in this example is the Stem::Console cell.
24
25 =head2 COMMAND METHOD
26
27 The following code snippet in the F<World1> class cell is the method
28 that will receive a hello command from a remote sender.
29
30     package World1;
31
32     sub hello_cmd {
33
34         return "Hello world!\n";
35     }
36
37 B<Stem> makes the creation of Command message handling methods very
38 I<easy>.  Any return with defined data will automatically be sent back
39 to the sender of this command in a response type message. In the
40 method above we return the "Hello world!\n" string which will get printed on 
41 the console.
42
43 For more information on how a message is routed to its destination
44 cell in B<Stem> please see the F<Stem Messaging Design Notes>.
45
46 =head1 THE CONFIGURATION FILE
47
48 The following B<Stem> configuration file is used to bring a
49 World1 class level cell into existance in the B<Stem> environment.
50
51 -
52  class: Stem::Console
53 -
54  class: World1
55
56 The first entry is C<Stem::Console>, a class level cell allows a user
57 to manually send command messages into the B<Stem> system.  It is not
58 required for this module, but it is used in this example to send
59 messages to the World1 class and to print responses from it.  The
60 second entry loads the C<World1> class. We can now refer to this class
61 cell as I<World1> when we want to send it a message.
62
63 =head1 USAGE
64
65 Execute C<run_stem world> from the command line to run this configuration.
66 You will be greeted with the B<StemE<gt>> prompt.  It is now
67 possible to send a message manually to I<World1>.  Type the following
68 command at the B<Stem> prompt:
69
70 B<World1 hello>
71
72 This is standard B<Stem> Console syntax, the cell address followed by
73 the command name.  This will send a message world_cmd method in the
74 C<World1> class cell. That method returns a value, which is converted
75 into a response message addressed to Stem::Console (the originator of
76 the command message), and its data will be printed on the console terminal.
77
78 B<"Hello world!">
79
80 =cut
81
82 1 ;