summaryrefslogtreecommitdiff
path: root/Examples/perl5/funcptr/runme.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/perl5/funcptr/runme.pl')
-rw-r--r--Examples/perl5/funcptr/runme.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/Examples/perl5/funcptr/runme.pl b/Examples/perl5/funcptr/runme.pl
new file mode 100644
index 0000000..a73b538
--- /dev/null
+++ b/Examples/perl5/funcptr/runme.pl
@@ -0,0 +1,21 @@
+# file: runme.pl
+
+use example;
+
+$a = 37;
+$b = 42;
+
+# Now call our C function with a bunch of callbacks
+
+print "Trying some C callback functions\n";
+print " a = $a\n";
+print " b = $b\n";
+print " ADD(a,b) = ", example::do_op($a,$b,$example::ADD),"\n";
+print " SUB(a,b) = ", example::do_op($a,$b,$example::SUB),"\n";
+print " MUL(a,b) = ", example::do_op($a,$b,$example::MUL),"\n";
+
+print "Here is what the C callback function objects look like in Perl\n";
+print " ADD = $example::ADD\n";
+print " SUB = $example::SUB\n";
+print " MUL = $example::MUL\n";
+