added checking of result when building demos
[urisagit/Stem.git] / Cookbook / World5.pm
CommitLineData
4536f655 1package World5 ;
2
3use strict;
4
5use base 'Stem::Cell' ;
6
7my $attr_spec =
8[
9 {
10 'name' => 'planet',
11 'default' => 'world',
12 },
13 {
14 'name' => 'cell_attr',
15 'class' => 'Stem::Cell',
16 },
17];
18
19sub new {
20
21 my( $class ) = shift ;
22 my $self = Stem::Class::parse_args( $attr_spec, @_ ) ;
23 return $self unless ref $self ;
24
25# Track the object in the class level hash %planets
26
27 return ( $self );
28}
29
30sub triggered_cell {
31
32 my( $self ) = @_ ;
33
34 $self->{'planet'} = $self->cell_get_args( 'planet' ) || 'pluto' ;
35
36 return;
37}
38
39# based on who was the receiver of the message
40# we return with the appropriate response
41
42sub hello_cmd {
43
44 my( $self ) = @_;
45
46 return "Hello world from $self->{'planet'}\n" ;
47}
48
49=head1 Stem Cookbook - World3
50
51=head1 NAME
52
53World5
54
55=head1 DESCRIPTION
56
57=cut
58
591;