Perl is a very powerful scripting language and is fully supported by The Uniform Server Zero XII. You can install one of two distributions, either Portable Strawberry Perl via a Uniform Server Zero XII Plugin or Active Perl. The ActivePerl Community License precludes distribution with The Uniform Server Zero XII; you will need to download this yourself and use The Uniform Server Zero's built-in installation batch file script. Rmainder of this page; covers UniControllers Perl control menu. OverviewInstall Perl as explained on this page Installing Perl The Uniform Server XII automatically detects the presence of Perl and enables UniController. If Perl is not installed, the Perl menu is greyed out. Place your Perl scripts in folder UniServerZ\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: #!C:/UniServerZ/core/perl/bin/perl.exeOr (Unix format) #!/usr/bin/perl Note: The #! means "use the following command/interpreter to run this script". Generally the command/interpreter is the absolute path to an executable Next section covers the Shebang in more detail. ShebangThe Shebang format you use is dependent on a number of factors such as on how the Apache server is run (either as a standard program or as a service) and the operating system. Apache – Running as standard programWhen Apache is started from UniController it is run as a standard program and is fully portable. #!perl Moving UniServer Zero to another location automatically updates the path environment variable. Tip: When writing Perl scripts for Windows always use #!perl for the shebang. Important: When you place a third party Perl script in cgi-bin, you must always run Force Windows Shebang using UniController this converts the Unix Shebang to the Windows format. Alternatively, you can manually edit each file and replace the Unix Shebang "#!/usr/bin/perl" with the Windows Shebang "#!perl". Apache – Running as serviceWhen Apache is started from UniService it is run as a service and is no-longer portable. Running as a service requires the Shebang to be an absolute path for example: #!C:/UniServerZ/core/perl/bin/perl.exe You need to edit each file and replace the Shebang with "#!C:/UniServerZ/core/perl/bin/perl.exe", if you installed Uniform Server in a different location adjust the path as appropriate. Although inconvenient it is a relatively easy task to search all files in cgi-bin and replace the Shebang. Note 1: The above runs on any Windows OS from XP to Win 10. Shebang HelpPerl > Shebang Help The Perl "Shebang Help" menu displays the following: Shebang Help:
Force Windows ShebangAfter installing third-party scripts to the cgi-bin folder. Force a Windows shebang update by running Force Windows Shebang from the Perl drop-down menu. Perl > Force Windows Shebang This updates all files with the following file extensions in folder cgi-bin and any sub-folders
Replaces the current shebang with #!perl Force Unix ShebangPerl scripts developed on Windows will not run on a Unix machine. They require conversion to Unix format. Force a format update by running Force Unix Shebang from the Perl drop-down menu. Perl > Force Unix Shebang This updates all files with the following file extensions in folder cgi-bin and any sub-folders
Replaces the current shebang with #!/usr/bin/perl View test.plView test.pl runs test script: UniServerZ\cgi-bin\test.pl Perl > View test.pl test.pl #!perl print <<END_of_HTML; Content-type: text/html <HTML> <HEAD> <TITLE>Perl Test Page</TITLE> </HEAD> <BODY> <H1>Perl test page</H1> <P>Basic Perl test pages.</P> <ul> <li><a href="http://localhost/cgi-bin/test_1.pl/" target="_blank">test_1.pl - Display Perl environment</a></i> <li><a href="http://localhost/cgi-bin/test_2.pl/" target="_blank">test_2.pl - Basic "Hello world" uses here-doc <<END statement:</a></i> <li><a href="http://localhost/cgi-bin/test_3.pl/" target="_blank">test_3.pl - Basic "Hello world" uses use CGI qw(:standard)</a></i> <li><a href="http://localhost/cgi-bin/test_4.pl/" target="_blank">test_4.pl - Basic user input form 1</a></i> <li><a href="http://localhost/cgi-bin/test_5.pl/" target="_blank">test_5.pl - Basic user input form 2</a></i> </ul> <p>The above test pages are located in folder <b>UniServerZ\\cgi-bin</b> after testing these pages can be deleted:<br /> Main Test page test.pl and pages test_1.pl to test_5.pl</p> </BODY> </HTML> END_of_HTML Where to go nextInstalling Perl - Covers installing ActivePerl and Strawberry Perl |