1#!perl
2
3# Simple ARExx Host
4
5use strict;
6use Amiga::ARexx;
7use feature "switch";
8
9my $host = Amiga::ARexx->new('HostName' => "TESTSCRIPT");
10
11my $alive = 1;
12
13while ($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
47