|
|||||
operator |
#! |
Syntax
#! path-to-executable
Some web servers (such as Apache) require that all CGI programs begin with a #! directive that tells the web
server where to find the software to run the CGI program. In an OmniMark program, this directive must include
the full path and name of your OmniMark executable, followed by a command-line option:
#!/usr/local/omnimark/omnimark -s process output "Content-type: text/plain%n%n" || "hello world!%n"
The command-line option in the #! directive might look a little strange to people used to the OmniMark command
line, since the -s
option isn't followed by a filename. This is because the #! line
implicitly refers to the file in which the #! line occurs. For example, assuming that the program above is saved
as helloworld.xom
, your operating system will interpret the #! directive in the program as:
#!/usr/local/omnimark/omnimark -s helloworld.xom
The #! directive can be used in an arguments file as well:
#!/usr/local/omnimark/omnimark -f -s helloworld.xom -x /usr/local/omnimark/lib/=L.so -i /usr/local/omnimark/xin/
The -f
in the arguments file works the same way as the -s
in the
program: your operating system interprets the -f
as being followed by the name of the
arguments file itself.
Using a #! directive in OmniMark programs does not reduce the portability of your code: OmniMark ignores the #! line as if it were a comment, as do web servers that don't require it. Note, however, that if you use a #! line, it must be the first line in the program. Having anything other than white space preceding the #! line produces an error.
Copyright © Stilo International plc, 1988-2010.