5.0-Nano: Perl: Difference between revisions
mNo edit summary |
m (Text replace - "projects/uniformserver" to "projects/miniserver") |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
'''Uniform Server 5.0-Nano and Perl''' | '''Uniform Server 5.0-Nano and Perl''' | ||
Although | Although Uniform Server no longer uses Perl for server control, it remains fully supported. | ||
Perl is a very powerful scripting language | Perl is a very powerful scripting language. To do it justice, two plugins are provided: full and mini Perl. | ||
Full-Perl as the name implies consists of the core program and all modules, while mini-Perl consists of the core program and a selection of commonly used Perl modules. | |||
== ActivePerl == | == ActivePerl == | ||
Uniform Server's Perl plugins use [http://www.activestate.com/activeperl/features/ ActivePerl] from [http://www.activestate.com/ ActiveState] | Uniform Server's Perl plugins use [http://www.activestate.com/activeperl/features/ ActivePerl] from [http://www.activestate.com/ ActiveState]. The version currently in use is ActivePerl 5.10.1.1007. It’s an industry-standard Perl distribution. | ||
ActivePerl is multi platform | ActivePerl is multi-platform and runs on Windows, Linux, Mac OS X, Solaris, AIX and HP-UX. | ||
Apart from being robust and reliable, one of its main features is portability. | |||
== Plugins == | == Plugins == | ||
There are two plugins to choose from either full or mini. | There are two plugins to choose from either full or mini. Each is available in the three following versions: | ||
'''''Perl Versions''''' | '''''Perl Versions''''' | ||
*ActivePerl 5.10. | *ActivePerl 5.10.1.1005 | ||
*ActivePerl 5.10. | *ActivePerl 5.10.1.1006 | ||
*ActivePerl 5.10.1.1007 | |||
The mini plugin is suitable for majority of smaller applications. For more advanced applications, download the full plugin. | |||
=== Download === | === Download === | ||
Download the plugins from [http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/ Sourceforge] and choose one of the following: | |||
'''ActivePerl 5.10. | '''ActivePerl 5.10.1.1005''' | ||
{|cellpadding="4" cellspacing="3" | {|cellpadding="4" cellspacing="3" | ||
|-style="background:#F4F4F4;" | |-style="background:#F4F4F4;" | ||
Line 44: | Line 42: | ||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.0_full_perl/V5.0_full_perl.zip/download V5.0_full_perl.zip]||16.0 MB ||52.2 MB ||Contains Perl core program and full set of Perl modules. | |[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.0_full_perl/V5.0_full_perl.zip/download V5.0_full_perl.zip]||16.0 MB ||52.2 MB ||Contains Perl core program and full set of Perl modules. | ||
|} | |} | ||
'''ActivePerl 5.10. | '''ActivePerl 5.10.1.1006''' | ||
{|cellpadding="4" cellspacing="3" | {|cellpadding="4" cellspacing="3" | ||
|-style="background:#F4F4F4;" | |-style="background:#F4F4F4;" | ||
Line 56: | Line 54: | ||
|-style="background:#F4F4F4;" | |-style="background:#F4F4F4;" | ||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.1_full_perl/V5.1_full_perl.zip/download V5.1_full_perl.zip]||16.5 MB ||54.1 MB ||Contains Perl core program and full set of Perl modules. | |[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.1_full_perl/V5.1_full_perl.zip/download V5.1_full_perl.zip]||16.5 MB ||54.1 MB ||Contains Perl core program and full set of Perl modules. | ||
|} | |||
'''ActivePerl 5.10.1.1007''' | |||
{|cellpadding="4" cellspacing="3" | |||
|-style="background:#F4F4F4;" | |||
|'''File name'''||'''Compressed'''||'''Uncompressed'''||'''Comments''' | |||
|-style="background:#F4F4F4;" | |||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Mini%20Perl/V5.2_mini_perl/V5.2_mini_perl.exe/download V5.2_mini_perl.exe]||5.17 MB ||17.3 MB ||Contains Perl core program with a collection of commonly used Perl modules. | |||
|-style="background:#F4F4F4;" | |||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Mini%20Perl/V5.2_mini_perl/V5.2_mini_perl.zip/download V5.2_mini_perl.zip]||7.27 MB ||17.3 MB||Contains Perl core program with a collection of commonly used Perl modules. | |||
|-style="background:#F4F4F4;" | |||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.2_full_perl/V5.2_full_perl.exe/download V5.2_full_perl.exe]||11 MB ||55.2 MB ||Contains Perl core program and full set of Perl modules. | |||
|-style="background:#F4F4F4;" | |||
|[http://sourceforge.net/projects/miniserver/files/Plugins/Uniform%20Server%205-Nano%20Plugins/Full%20Perl/V5.2_full_perl/V5.2_full_perl.zip/download V5.2_full_perl.zip]||16.7 MB ||55.2 MB ||Contains Perl core program and full set of Perl modules. | |||
|} | |} | ||
I hope non-Perl users will appreciate the significant overhead this represents, even with mini-Perl installed, which was the reason for making Perl a plugin. | |||
If space is at a premium Perl users can start with mini-Perl and add modules as required from full-Perl. | If space is at a premium, Perl users can start with mini-Perl and add modules as required from full-Perl. | ||
'''''Note'':''' Don't mix modules from different versions. | '''''Note'':''' Don't mix modules from different versions. | ||
=== Install === | === Install === | ||
Line 72: | Line 82: | ||
* Copy file V5.#_mini_perl.exe or V5.#_full_perl.exe to folder UniServer | * Copy file V5.#_mini_perl.exe or V5.#_full_perl.exe to folder UniServer | ||
* Double click on file to run the self-extracting archive | * Double click on the file to run the self-extracting archive | ||
* For Perl to be picked up restart the servers. | * For Perl to be picked up, restart the servers. | ||
This creates two new folders, bin and lib, in folder UniServer\usr | |||
These contain the Perl program and Perl modules respectively. | These contain the Perl program and Perl modules respectively. | ||
Line 89: | Line 99: | ||
These contain the Perl program and Perl modules respectively. | These contain the Perl program and Perl modules respectively. | ||
== Support enabled == | == Support enabled == | ||
UniServer automatically detects the presence of Perl and enables functionality to support it in both Apanel and UniTray. | UniServer automatically detects the presence of Perl and enables functionality to support it in both Apanel and UniTray. | ||
=== Auto tracking === | === Auto tracking === | ||
Perl scripts | Perl scripts should be placed 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: | |||
Each script requires a | |||
<pre> | <pre> | ||
#!C:/Test/UniServer/usr/bin/perl.exe | #!C:/Test/UniServer/usr/bin/perl.exe | ||
</pre> | </pre> | ||
Moving UniServer to another location automatically updates this | Moving UniServer to another location automatically updates this Shebang. | ||
Server control, on detecting a server move, writes a new Shebang to all files with a '''.pl''' or '''.cgi''' extension. | |||
Server control on detecting a server move writes a new | |||
An automatic update is initiated '''only''' when the servers are '''moved'''. | An automatic update is initiated '''only''' when the servers are '''moved'''. | ||
'''''Important''''' | '''''Important''''' | ||
After extracting a third party Perl script to cgi-bin you must either move the servers or '''force a | After extracting a third party Perl script to cgi-bin, you must either move the servers or '''force a Shebang update''' using UniTray. Alternatively, you can manually edit each file. | ||
=== Apanel support === | === Apanel support === | ||
A new menu option becomes available in Apanel when Perl is installed. This displays the Perl environment and additional information. | |||
=== UniTray support === | === UniTray support === | ||
==== Force | ==== Force Shebang update ==== | ||
Perl scripts contain a Shebang (first line) | Perl scripts contain a Shebang (first line) which informs a server where to find the Perl program. Uniform Server is dynamic and tracks any path changes automatically updating the Shebang. | ||
However if the server remains static and you have added new scripts in the cgi-bin folder the Shebang is never updated. | However if the server remains static and you have added new scripts in the cgi-bin folder, the Shebang is never updated. Therefore run the following menu item after installing new scripts. It updates the Shebang in all files to the current Perl location. | ||
Line 131: | Line 135: | ||
'''''Tip'':''' | '''''Tip'':''' | ||
When writing Perl scripts you can use the following for the | When writing Perl scripts you can use the following for the Shebang: | ||
<pre> | <pre> | ||
#! | #! | ||
</pre> | </pre> | ||
From UniTray run "Perl Shebang Update cgi-bin" and all pages will be updated with the correct shebang. | From UniTray, run "Perl Shebang Update cgi-bin" and all pages will be updated with the correct shebang. | ||
==== Convert to Unix format ==== | ==== Convert to Unix format ==== | ||
Perl scripts developed on Windows will not run on a Unix machine | Perl scripts developed on Windows will not run on a Unix machine. They require conversion to Unix format. | ||
Run the conversion script from UniTray as follows: | Run the conversion script from UniTray as follows: | ||
Line 152: | Line 154: | ||
Scripts in this new folder are converted from Windows to Unix format. | Scripts in this new folder are converted from Windows to Unix format. | ||
*Converts end of line: Dec(#10#13=>#13) Hex 0D0A to 0A | *Converts end of line: Dec(#10#13=>#13) Hex 0D0A to 0A | ||
*Replaces Windows | *Replaces Windows Shebang with Unix Shebang | ||
== Related Topic Links == | == Related Topic Links == | ||
[[Perl CGI Hello World | Perl CGI Hello World]] - Short snippets to get you started with Perl | [[Perl CGI Hello World | Perl CGI Hello World]] - Short snippets to get you started with Perl | ||
== Summary == | == Summary == | ||
Uniform Server has been pre-configured for Perl | Uniform Server has been pre-configured for Perl, so after installing either of the plugins, Perl is ready to run scripts. | ||
For convenience any Uniform Server plugin requiring Perl support such as AWStats come complete with mini-Perl and any additional modules required to support that plugin. | For convenience, any Uniform Server plugin requiring Perl support, such as AWStats, come complete with mini-Perl and any additional modules required to support that plugin. | ||
[[5.0-Nano: UniTray | '''Next page''']] covers UniTray | [[5.0-Nano: UniTray | '''Next page''']] covers UniTray | ||
---- | ---- | ||
[[Category: Uniform Server 5.0-Nano]] | [[Category: Uniform Server 5.0-Nano]] |
Latest revision as of 16:09, 17 October 2012
5-Nano: Introduction | Install and Run | Control | DtDNS | Cron| Security features | Enable SSL | Multi-Servers | Perl | UniTray | Security and passwords | Known Issues | Support
|
|
Uniform Server 5.0-Nano and Perl
Although Uniform Server no longer uses Perl for server control, it remains fully supported.
Perl is a very powerful scripting language. To do it justice, two plugins are provided: full and mini Perl. Full-Perl as the name implies consists of the core program and all modules, while mini-Perl consists of the core program and a selection of commonly used Perl modules.
ActivePerl
Uniform Server's Perl plugins use ActivePerl from ActiveState. The version currently in use is ActivePerl 5.10.1.1007. It’s an industry-standard Perl distribution.
ActivePerl is multi-platform and runs on Windows, Linux, Mac OS X, Solaris, AIX and HP-UX. Apart from being robust and reliable, one of its main features is portability.
Plugins
There are two plugins to choose from either full or mini. Each is available in the three following versions:
Perl Versions
- ActivePerl 5.10.1.1005
- ActivePerl 5.10.1.1006
- ActivePerl 5.10.1.1007
The mini plugin is suitable for majority of smaller applications. For more advanced applications, download the full plugin.
Download
Download the plugins from Sourceforge and choose one of the following:
ActivePerl 5.10.1.1005
File name | Compressed | Uncompressed | Comments |
V5.0_mini_perl.exe | 5.07 MB | 16.5 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.0_mini_perl.zip | 7.13 MB | 16.5 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.0_full_perl.exe | 10.6 MB | 52.2 MB | Contains Perl core program and full set of Perl modules. |
V5.0_full_perl.zip | 16.0 MB | 52.2 MB | Contains Perl core program and full set of Perl modules. |
ActivePerl 5.10.1.1006
File name | Compressed | Uncompressed | Comments |
V5.1_mini_perl.exe | 5.14 MB | 16.9 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.1_mini_perl.zip | 7.21 MB | 16.9 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.1_full_perl.exe | 10.9 MB | 54.1 MB | Contains Perl core program and full set of Perl modules. |
V5.1_full_perl.zip | 16.5 MB | 54.1 MB | Contains Perl core program and full set of Perl modules. |
ActivePerl 5.10.1.1007
File name | Compressed | Uncompressed | Comments |
V5.2_mini_perl.exe | 5.17 MB | 17.3 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.2_mini_perl.zip | 7.27 MB | 17.3 MB | Contains Perl core program with a collection of commonly used Perl modules. |
V5.2_full_perl.exe | 11 MB | 55.2 MB | Contains Perl core program and full set of Perl modules. |
V5.2_full_perl.zip | 16.7 MB | 55.2 MB | Contains Perl core program and full set of Perl modules. |
I hope non-Perl users will appreciate the significant overhead this represents, even with mini-Perl installed, which was the reason for making Perl a plugin.
If space is at a premium, Perl users can start with mini-Perl and add modules as required from full-Perl.
Note: Don't mix modules from different versions.
Install
exe
By far the easiest way to install Perl is to download one of the executables and install as follows:
- Copy file V5.#_mini_perl.exe or V5.#_full_perl.exe to folder UniServer
- Double click on the file to run the self-extracting archive
- For Perl to be picked up, restart the servers.
This creates two new folders, bin and lib, in folder UniServer\usr These contain the Perl program and Perl modules respectively.
zip
Installing from a zip file requires a few extra steps as follows:
- Copy file V5.#_mini_perl.zip or V5.#_full_perl.zip to any folder.
- Extract to current path.
- Copy folders bin and lib to folder UniServer\usr
- For Perl to be picked up restart the servers.
These contain the Perl program and Perl modules respectively.
Support enabled
UniServer automatically detects the presence of Perl and enables functionality to support it in both Apanel and UniTray.
Auto tracking
Perl scripts should be placed 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:
#!C:/Test/UniServer/usr/bin/perl.exe
Moving UniServer to another location automatically updates this Shebang. Server control, 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
After extracting a third party Perl script to cgi-bin, you must either move the servers or force a Shebang update using UniTray. Alternatively, you can manually edit each file.
Apanel support
A new menu option becomes available in Apanel when Perl is installed. This displays the Perl environment and additional information.
UniTray support
Force Shebang update
Perl scripts contain a Shebang (first line) which informs a server where to find the Perl program. Uniform Server is dynamic and tracks any path changes automatically updating the Shebang.
However if the server remains static and you have added new scripts in the cgi-bin folder, the Shebang is never updated. Therefore run the following menu item after installing new scripts. It updates the Shebang in all files to the current Perl location.
left click tray icon > Advance > click "Perl Shebang Update cgi-bin"
Tip:
When writing Perl scripts you can use the following for the Shebang:
#!
From UniTray, run "Perl Shebang Update cgi-bin" 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. Run the conversion script from UniTray as follows:
left click tray icon > Advance > click "Perl win2unix + Shebang Update"
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(#10#13=>#13) Hex 0D0A to 0A
- Replaces Windows Shebang with Unix Shebang
Related Topic Links
Perl CGI Hello World - Short snippets to get you started with Perl
Summary
Uniform Server has been pre-configured for Perl, so after installing either of the plugins, Perl is ready to run scripts.
For convenience, any Uniform Server plugin requiring Perl support, such as AWStats, come complete with mini-Perl and any additional modules required to support that plugin.
Next page covers UniTray