This program allows for multiple scripts to be put inside of a script file. Multiscript consists of a extensible Perl script that then runs the .sx scripts. It allows for the files.sx to contain more than one language by using tags to dilineate where the script code ends and begins.
The Multiscript program loads the script.sx file. It then creates a temporary file to store the script code in between code tags. If a particular command option is selected it will then store the code in the temporary file and execute at the end of tag code block. The temporary file is used as a buffer to store execution script code. The temporary file is cleared at the end code tag. The temporary file is also removed at code completion.
The test.sx file is listed as follows. It contains three
code groups for helloworld. One code group is Perl, Python and ruby.
Different code groups can be added to allow other languages in the same
script. Command
arguments can also be assigned to the scripts as well as version
numbers.
<code>
#!/usr/local/perl
print "hello World\n";
</code>
<code python>
#!/usr/local/python
print "Hello World"
</code python>
<code ruby>
#!/usr/local/python
puts "Hello World"
</code ruby>
The following code for test_args.sx illustrates attributes and arguments that can be used to define code arguments and the language by the l and args attribute.
<code l="perl" args="1 2 3 4 5 6">The following code illustrates Unix shell code for helloworld
<code l="csh">This is a unix example of running the program. The code
tag is a current default set as Perl. The -python option specifies
python.
[home/user/george]$ sx.pl -version
sx.pl Version .2
[home/user/george]$ sx.pl -file test.sx
Hello World [perl]
[home/user/george]$ sx.pl -f test.sx -python
Hello World [perl]
Hello World [python]
[home/user/george]$ sx.pl -f test.sx -python -ruby
Hello World [perl]
Hello World [python]
Hello World [ruby]
[home/user/george]$ sx.pl -f test_args.sx
There are 6 args
[home/user/george]$ sx.pl -f test_version.sx -pv 1.2b
This is program version 1.2b
(1) Improve the tag parser.
(2) Add more command line options.
(3) Improve and complete error handling.
(4) Add more example scripts
The current multiscript version is .03.
This code has been released under the GPL and Artistic License
Nathan Ross
© 2005 Nathan Ross