Difference between revisions of "Coral: perl intro"
(Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font...")
Latest revision as of 13:50, 12 November 2011
Perl - Introduction Guide
Perl is a very powerful scripting language and is fully supported by The Uniform Server. Since the ActivePerl Community License precludes distribution with The Uniform Server, you will have to download it yourself. However, Perl is easy to install when using The Uniform Server's builtin script. For details, see Perl - Installing ActivePerl. This page covers UniController's menu option that displays the Perl control panel.
The Uniform Server automatically detects the presence of Perl and enables the functionality to support it in UniController. If Perl is not installed, the Perl control panel buttons are greyed out.
Place your Perl scripts in folder UniServer\cgi-bin and any sub-folders as appropriate. Each script requires a Shebang. This must be an absolute path to the Perl executable. For example:
Moving UniServer to another location automatically updates this Shebang. UniController, on detecting a server move, writes a new Shebang to all files with a .pl or .cgi extension. An automatic update is initiated only when the servers are moved.
Important: When you place a third party Perl script in cgi-bin, you must either move the servers or force a Shebang update using UniController. Alternatively, you can manually edit each file.
Force Shebang update
Perl scripts contain a Shebang (the first line) which informs a server where to find the Perl program. The Uniform Server is dynamic and tracks any path changes, automatically updating the Shebang.
However if the server remains static and you add new scripts, the Shebang is never updated. You must therefore run "Force Shebang update" from the Perl control panel. It updates the Shebang to the current Perl location in all files.
Tip: When writing Perl scripts you can use the following for the Shebang:
From the Perl control panel, run "Perl Shebang Update" and all pages will be updated with the correct Shebang.
Convert to Unix format
Perl scripts developed on Windows will not run on a Unix machine. They require conversion to Unix format. You can run the conversion script from the Perl control panel.
This script copies all files in cgi-bin to a new folder \cgi-bin-unix\
Scripts in this new folder are converted from Windows to Unix format.
- Converts end of line: Dec(#13#10=>#10) Hex 0D0A to 0A
- Replaces Windows Shebang with Unix Shebang
Perl control panel
This sub-menu option opens the Perl control panel.
Server Configuration > Perl > Perl control panel