summaryrefslogtreecommitdiff
path: root/ext/Amiga-ARexx/__examples
diff options
context:
space:
mode:
authorAndy Broad <andy@broad.ology.org.uk>2015-08-13 21:04:20 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-09-05 11:12:42 -0400
commit4ceeac6459d42a70899b69552f533a005203bef9 (patch)
tree51fba18e106a529fbcaabd83848877e00fb01187 /ext/Amiga-ARexx/__examples
parent1247ba6ed4b8140f991b9be96a5aa0c54650bd3f (diff)
downloadperl-4ceeac6459d42a70899b69552f533a005203bef9.tar.gz
amigaos4: add Amiga::ARexx and Amiga::Exec
ext seems more natural than dist since these are low-level OS glue modules (cf the VMS::* and Win32CORE), and these are not in CPAN.
Diffstat (limited to 'ext/Amiga-ARexx/__examples')
-rw-r--r--ext/Amiga-ARexx/__examples/simplecommand.pl14
-rw-r--r--ext/Amiga-ARexx/__examples/simplehost.pl46
2 files changed, 60 insertions, 0 deletions
diff --git a/ext/Amiga-ARexx/__examples/simplecommand.pl b/ext/Amiga-ARexx/__examples/simplecommand.pl
new file mode 100644
index 0000000000..85d447bb8a
--- /dev/null
+++ b/ext/Amiga-ARexx/__examples/simplecommand.pl
@@ -0,0 +1,14 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Amiga::ARexx qw(DoRexx);
+
+my ($result,$rc,$rc2) = DoRexx("WORKBENCH","HELP");
+
+print $result , "\n" , $rc, "\n", $rc2 , "\n";
+
+($result,$rc,$rc2) = DoRexx("WORKBENCH","NOHELP");
+
+print $result , "\n" , $rc, "\n", $rc2 , "\n";
diff --git a/ext/Amiga-ARexx/__examples/simplehost.pl b/ext/Amiga-ARexx/__examples/simplehost.pl
new file mode 100644
index 0000000000..df5ecd2ff4
--- /dev/null
+++ b/ext/Amiga-ARexx/__examples/simplehost.pl
@@ -0,0 +1,46 @@
+#!perl
+
+# Simple ARExx Host
+
+use strict;
+use Amiga::ARexx;
+use feature "switch";
+
+my $host = Amiga::ARexx->new('HostName' => "TESTSCRIPT");
+
+my $alive = 1;
+
+while ($alive)
+{
+ $host->wait();
+ my $msg = $host->getmsg();
+ while($msg)
+ {
+ my $rc = 0;
+ my $rc2 = 0;
+ my $result = "";
+
+ print $msg->message . "\n";
+ given($msg->message)
+ {
+ when ("QUIT")
+ {
+ $alive = 0;
+ $result = "quitting!";
+ }
+ when ("SHOUT")
+ {
+ $result = "HEEELLLLOOOO!";
+ }
+ default {
+ $rc = 10;
+ $rc2 = 22;
+ }
+ }
+ $msg->reply($rc,$rc2,$result);
+
+ $msg = $host->getmsg();
+ }
+
+}
+