- Subject: Using S-Lang in Perl
- From: Douglas Burke <dburke@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 28 Jan 2003 18:30:58 -0500 (EST)
Hi,
I have recently been working on a Perl module that will let you write
S-Lang code within your Perl programs. The idea is to let people use the
most familiar language for the task at hand.
I'd love comments & suggestions & testers on the package (although it is
at a "pre alpha" level), which can be got from CPAN
(http://search.cpan.org/author/DJBURKE/Inline-SLang/).
For those familiar with Perl, it uses the Inline package to provide the
basics of the interface. A working perl program using this module is
(please excuse the excessive indentation level):
use Inline SLang;
print "9 + 16 = ", add(9,16), "\n";
print "9 - 16 = ", subtract(9,16), "\n";
print JAxH('Inline'), "\n";
__END__
__SLang__
define add (a,b) { return a + b; }
define subtract (a,b) { return a - b; }
define JAxH () {
variable type = ();
return "Just Another " + string(type) + " Hacker!";
}
which produces
9 + 16 = 25
9 - 16 = -7
Just Another Inline Hacker!
Doug
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]