Debian Codegraph @

ext/Amiga-ARexx/__examples/simplehost.pl

raw
1 #!perl
2
3 # Simple ARExx Host
4
5 use strict;
6 use Amiga::ARexx;
7 use feature "switch";
8
9 my $host = Amiga::ARexx->new('HostName' => "TESTSCRIPT");
10
11 my $alive = 1;
12
13 while ($alive)
14 {
15 $host->wait();
16 my $msg = $host->getmsg();
17 while($msg)
18 {
19 my $rc = 0;
20 my $rc2 = 0;
21 my $result = "";
22
23 print $msg->message . "\n";
24 given($msg->message)
25 {
26 when ("QUIT")
27 {
28 $alive = 0;
29 $result = "quitting!";
30 }
31 when ("SHOUT")
32 {
33 $result = "HEEELLLLOOOO!";
34 }
35 default {
36 $rc = 10;
37 $rc2 = 22;
38 }
39 }
40 $msg->reply($rc,$rc2,$result);
41
42 $msg = $host->getmsg();
43 }
44
45 }
46