Multiscript programming allows for multiple scripts to be put inside of a script file. Multiscript consists of a extensible program that then runs the multilingual scripts. It allows for the script files to contain more than one language by using tags to dilineate where the program code starts and ends.
At command line execution a Multiscript program loads the script file and code tags. Second, the Multiscript processes the command line arguments. Third, Multiscript creates a temporary file to store the script code in between code tags. Fourth, the Multiscript program then parses the file and looks for tagged code blocks according to the command line options. The Multiscript program will then execute all of the code blocks, some of the code blocks or none of them.
If a particular argument option is selected it will then store the code in the temporary file at the starting "<code>" tag and execute the file at the end of tag "</code>" code. Multiscript uses a randomized read only temporary file as a buffer to store execution script code. At the end code tag the temporary file is executed by the appropriate language (defined by a tag attributes) and then the temp file is truncated for the next code block. At the end of multiscript file the temporary file is also removed since there is no more code to process and the program terminates.
test.multiscript is an example 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 example code for test_args.multiscript 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">On CPAN there is a Perl modulule CGI::Multiscript for Multiscript files. This module can be imported into a Perl script and parse and execute Multiscript files.
This is a unix example of running the flex command line program.
[home/user/adam]$ ms -version
Multiscript version 1.0
[home/user/adam]$ ms -file test.ms
Hello World [perl]
[home/user/adam]$ ms -f test.ms -python
Hello World [perl]
Hello World [python]
[home/user/adam]$ ms -f test.ms -python -ruby
Hello World [perl]
Hello World [python]
Hello World [ruby]
[home/user/adam]$ ms -f test_args.ms
There are 6 args
[home/user/adam]$ ms -f test_version.ms -pv 1.2b
This is program version 1.2b
[home/user/adam]$ ms -f webtest.cgi2.ms
<html>
<h1>This is heading 1</h1>
<P>Light
</P>
<P>
The time is February 25 2006
</code>
</p>
</html>
This button will run Multiscript script multiscript.ms.cgi
(0) Use An XML SAX parser.
(1) Improve the tag parser.
(2) Add more command line options.
(3) Add more example scripts.
The current Multiscript flex command line version is .50.
The current CGI::Multiscript Perl module version is .74.
This code has been released under the GPL and Artistic License.
Nathan Ross © 2006
Last updated on February 27, 2005