slang-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Using S-Lang in Perl


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]