PERL is the easiest to use and most widely utilised programming language on the Internet. PERL is an alternative to ASP for most users, and is sufficiently cross platform to have been ported to be able to run on most varieties of server. PERL version 5.6.1 is installed on the webspace service.
PERL is a form of CGI [Common Gateway Interface], and is most commonly what people are referring to when they mention CGI. Perl was invented by Larry Wall, who has written many books on the language. For more information about PERL as a programming language, and how to write PERL scripts, refer to the PERL Website.
PERL can be used on the webspace service as long as your file ends in the file extension .pl or .cgi and the following is the first line of your script:
#!/usr/local/bin/perl
Make sure to upload your files as ASCII [plain] text in your FTP program and not in binary mode, or they will not work! Click on one of the links below for more information on perl.
- Where do I find the system programs I want to use?
- Problems with getting scripts working
- How do i know if the site is broken?
- Do PERL scripts have to be placed in a cgi-bin directory?
- What PERL modules are installed?
- Can I install my own PERL modules?
Where do I find the system programs I want to use?
There is a page on this helpsite that explains the location of the various programs that you may wish your script to access. See here for more information.
Problems with getting scripts working
Like all other programming languages, PERL is not supported by Virgin Media. This means that, while the languages should work fine, we don't assist you in your coding and will only be able to help you out if your site's config does not work (see below).
If you have any issues with getting your PERL script to work, you should do the following:
- Examine the CGI logs for your site. These are available to you by logging into Self Care and downloading them. You can also login to your site via FTP, go up 1 directory and look in the logs/today directory.
- Check the permissions of your script. In 90%+ of cases, scripts fail (giving a 500 Internal Server Error) because the script does not have permissions to execute. Most FTP programs now give you the option to set your permissions. CGI scripts should be set to permissions of 755.
- Debug your code. Download one of the many code debuggers you can get on the web. Start with the URL above and look for perl resources. Change the "shebang" (the first line) of your perl script to put a "-w" after the path to perl (put a space in between). This will report all the workings of your script and may flag up what the issue is in your CGI logs.
- Get onto the newsgroups. Rename your script to be a .txt file and put it in your site's root directory (where you get put to when you login via FTP). Post a link to this file in blueyonder.discussion.pwp if you want help from fellow BY users. The best place to start, however, is the external newsgroup alt.perl.
How do i know if the site is broken?
It is possible (however unlikely) that your site isn't working for some reason. To identify whether this is the case, you should do the following:
- Download the test perl script source code here (then rename the file to 'test-perl.pl')
- Upload the file to your site
- Set the permissions to 755 via your FTP client
- Browse to the file in a browser
If you get the results of the script's execution in a browser (See a working example) a message that says:
I'm a Perl Script :-)
Then the problem is with your code and the site is working fine. See above as to how to best debug your code.
Make sure you have uploaded your files in ASCII (plain) text mode in your FTP program and not in binary mode or they will not work.
If you still get a failure, please report this in the support blueyonder.discussion.pwp or contact us.
Do PERL scripts have to be placed in a cgi-bin directory
No. If you wish to put your scripts anywhere in your htdocs/ document root, you can feel free. It is, however, convention to keep them in one place -- which is why you may wish to create a cgi-bin directory.
What restrictions are there on PERL?
We have disabled some functionality for security reasons. These include any script attempting to open network socket connections. These will not work.
All CGIs are sandboxed and chrooted. Sandboxing is the restriction of CPU usage that any one CGI script can utilise. If somebody writes a bad script, it can only get so big and then will stop growing. This is a protection measure to ensure the service is not affected by others. Chrooting is what the name suggests - Change Root. CGI scripts only have access to the necessary programs they have to on the server to be able to function as they cannot get to the system directories or files because as far as they are concerned the root of the server is your own personal webspace area.
The only other restrictions on CGIs are the standard acceptable usage restrictions as per the Virgin Media Acceptable Use Policy.
What PERL modules are installed?
The following modules [additional to the default config] are installed on the webspace service (see the point above about modules that have been disabled):
- B - The Perl Compiler
- ByteLoader (0.04) - load byte compiled perl code Config - access Perl configuration information
- DynaLoader (1.04) - Dynamically load C libraries into Perl code
- Errno (1.111) - System errno constants
- Fcntl (1.03) - load the C Fcntl.h defines
- GDBM_File (1.05) - Perl5 access to the gdbm library.
- IO (1.20) - load various IO modules
- NDBM_File (1.04) - Tied access to ndbm files
- O - Generic interface to Perl Compiler backends
- ODBM_File (1.03) - Tied access to odbm files
- Opcode (1.04) - Disable named opcodes when compiling perl code
- SDBM_File (1.03) - Tied access to sdbm files
- Safe (2.06) - Compile and execute code in restricted compartments
- Socket (1.72) - load the C socket.h defines and structure manipulators
- XSLoader (0.01) - Dynamically load C libraries into Perl code
- attrs (1.0) - set/get attributes of a subroutine (deprecated)
- ops - Perl pragma to restrict unsafe operations when compiling
- re (0.02) - Perl pragma to alter regular expression behaviour
- Sys::Hostname (1.1) - Try every conceivable way to get hostname
- Sys::Syslog (0.01) - Perl interface to the UNIX syslog(3) calls
- IPC::Msg (1.00) - SysV Msg IPC object class
- IPC::Semaphore (1.00) - SysV Semaphore IPC object class
- IPC::SysV (1.03) - SysV IPC constants
- IO::Dir (1.03) - supply object methods for directory handles
- IO::File (1.08) - supply object methods for filehandles
- IO::Handle (1.21) - supply object methods for I/O handles
- IO::Pipe (1.121) - supply object methods for pipes
- IO::Poll (0.05) - Object interface to system poll call
- IO::Seekable (1.08) - supply seek based methods for I/O objects
- IO::Select (1.14) - OO interface to the select system call
- IO::Socket (1.26) - Object interface to socket communications
- File::Glob (0.991) - Perl extension for BSD glob routine
- Devel::DProf - a Perl code profiler
- Devel::Peek (1.00_01) - A data debugging tool for the XS programmer
- Data::Dumper (2.102) - stringified perl data structures, suitable for both printing and C<eval>
- B::Asmdata - Autogenerated data about Perl ops, used to generate bytecode
- B::Assembler (0.02) - Assemble Perl bytecode
- B::Bblock - Walk basic blocks
- B::Bytecode - Perl compiler's bytecode backend
- B::C - Perl compiler's C backend
- B::CC - Perl compiler's optimized C translation backend
- B::Concise (0.51) - Walk Perl syntax tree, printing concise info about ops
- B::Debug - Walk Perl syntax tree, printing debug info about ops
- B::Deparse (0.6) - Perl compiler backend to produce perl code
- B::Disassembler - Disassemble Perl bytecode
- B::Lint - Perl lint
- B::Showlex - Show lexical variables used in functions or files
- B::Stackobj - Helper module for CC backend
- B::Stash (-umain,-uattributes,-uDB) - show what stashes are loaded
- B::Terse - Walk Perl syntax tree, printing terse info about ops
- B::Xref - Generates cross reference reports for Perl programs
- AnyDBM_File - provide framework for multiple DBMs
- AutoLoader (5.58) - load subroutines only on demand
- AutoSplit (1.0305) - split a package for autoloading
- Benchmark (1) - benchmark running times of Perl code
- CGI (2.752) - Simple Common Gateway Interface Class
- Carp - warn of errors (from perspective of caller)
- Cwd (2.04) - get pathname of current working directory
- DB (1.0) - programmatic interface to the Perl debugging API (draft, subject to change)
- DirHandle - supply object methods for directory handles
- Dumpvalue - provides screen dump of Perl data.
- English - use nice English (or awk) names for ugly punctuation variables
- Env - perl module that imports environment variables as scalars or arrays
- Exporter (5.562) - Implements default import method for modules
- Fatal (1.02) - replace functions with equivalents which succeed or die
- FileCache - keep more files open than the system permits
- FindBin (1.42) - Locate directory of original perl script
- FileHandle (2.00) - supply object methods for filehandles
- SelectSaver - save and restore selected file handle
- SelfLoader (1.0902) - load functions only on demand
- Shell (0.3) - run shell commands transparently within perl
- Symbol (1.02) - manipulate Perl symbols and their names
- Test (1.15) - provides a simple framework for writing test scripts
- UNIVERSAL - base class for ALL classes (blessed references)
- attributes (0.03) - get/set subroutine or variable attributes
- autouse (1.02) - postpone load of modules until a function is used
- base (1.01) - Establish IS-A relationship with base class at compile time
- blib (1.00) - Use MakeMaker's uninstalled version of a package
- bytes - Perl pragma to force byte semantics rather than character semantics
- charnames - define character names for C<\N{named}> string literal escape.
- constant (1.02) - Perl pragma to declare constants
- diagnostics () - Perl compiler pragma to force verbose warning diagnostics
- fields (1.01) - compile-time class fields
- filetest - Perl pragma to control the filetest permission operators
- integer - Perl pragma to use integer arithmetic instead of floating point
- less - perl pragma to request less of something from the compiler
- lib (0.5564) - manipulate @INC at compile time
- locale - Perl pragma to use and avoid POSIX locales for built-in operations
- open - perl pragma to set default disciplines for input and output
- overload - Package for overloading perl operations
- sigtrap (1.02) - Perl pragma to enable simple signal handling
- strict (1.01) - Perl pragma to restrict unsafe constructs
- subs - Perl pragma to predeclare sub names
- utf8 - Perl pragma to enable/disable UTF-8 in source code
- vars - Perl pragma to predeclare global variable names (obsolete)
- User::grent - by-name interface to Perl's built-in getgr*() functions
- User::pwent - by-name interface to Perl's built-in getpw*() functions
- Time::Local - efficiently compute time from local and GMT time
- Time::gmtime (1.01) - by-name interface to Perl's built-in gmtime() function
- Time::localtime (1.01) - by-name interface to Perl's built-in localtime() function
- Time::tm - internal object used by Time::gmtime and Time::localtime
- Tie::Array (1.01) - base class for tied arrays
- Tie::Handle (4.0) - base class definitions for tied handles
- Tie::Hash - base class definitions for tied hashes
- Tie::RefHash (1.3) - use references as hash keys
- Tie::Scalar - base class definitions for tied scalars
- Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing
- Text::Abbrev - create an abbreviation table from a list
- Text::ParseWords (3.2) - parse text into an array of tokens or array of arrays
- Text::Soundex (1.0) - Implementation of the Soundex Algorithm as Described by Knuth
- Text::Tabs (98.112801) - expand and unexpand tabs per the unix expand(1) and unexpand(1)
- Text::Wrap (2001.0131) - line wrapping to form simple paragraphs
- Test::Harness (1.1604) - run perl standard test scripts with statistics
- Term::ANSIColor (1.03) - Color screen output using ANSI escape sequences
- Term::Cap - Perl termcap interface
- Term::Complete - Perl word completion module
- Term::ReadLine - Perl interface to various C<readline> packages. If no real
- package is found, substitutes stubs instead of basic functions.
- Search::Dict - search for key in dictionary file
- Pod::Checker (1.2) - check pod documents for syntax errors
- Pod::Find (0.21) - find POD documents in directory trees
- Pod::Html (1.03) - module to convert pod files to HTML
- Pod::InputObjects (1.13) - objects representing POD input paragraphs, commands, etc.
- Pod::LaTeX (0.53) - Convert Pod data to formatted Latex
- Pod::Man (1.15) - Convert POD data to formatted *roff input
- Pod::ParseUtils (0.22) - helpers for POD parsing and conversion
- Pod::Parser (1.13) - base class for creating POD filters and translators
- Pod::Plainer (0.01) - Perl extension for converting Pod to old style Pod.
- Pod::Select (1.13) - extract selected sections of POD from input
- Pod::Text (2.08) - Convert POD data to formatted ASCII text
- Pod::Usage (1.14) - print a usage message from embedded pod documentation
- Pod::Text::Color (0.06) - Convert POD data to formatted color ASCII text
- Pod::Text::Overstrike (1.01) - Convert POD data to formatted overstrike text
- Pod::Text::Termcap (1) - Convert POD data to ASCII text with format escapes
- Net::Ping (2.02) - check a remote host for reachability
- Net::hostent - by-name interface to Perl's built-in gethost*() functions
- Net::netent - by-name interface to Perl's built-in getnet*() functions
- Net::protoent - by-name interface to Perl's built-in getproto*() functions
- Net::servent - by-name interface to Perl's built-in getserv*() functions
- Math::BigFloat (0.02) - Arbitrary length float math package
- Math::BigInt (0.01) - Arbitrary size integer math package
- Math::Complex (1.31) - complex numbers and associated mathematical functions
- Math::Trig (1) - trigonometric functions
- IPC::Open2 (1.01) - open a process for both reading and writing
- IPC::Open3 (1.0103) - open a process for reading, writing, and error handling
- IO::Socket::INET (1.25) - Object interface for AF_INET domain sockets
- IO::Socket::UNIX (1.20) - Object interface for AF_UNIX domain sockets
- I18N::Collate - compare 8-bit scalar data according to the current locale
- Getopt::Long (2.25) - Extended processing of command line options
- Getopt::Std (1.02) - Process single-character switches with switch clustering
- File::Basename (2.6) - split a pathname into pieces
- File::CheckTree - run many filetest checks on a tree
- File::Compare (1.1002) - Compare files or filehandles
- File::Copy (2.03) - Copy files or filehandles
- File::DosGlob - DOS like globbing and then some
- File::Find - traverse a file tree
- File::Path (1.0404) - create or remove directory trees
- File::Spec (0.82) - portably perform operations on file names
- File::Temp (0.12) - return name and handle of a temporary file safely
- File::stat - by-name interface to Perl's built-in stat() functions
- File::Spec::Epoc - methods for Epoc file specs
- File::Spec::Functions (1.1) - portably perform operations on file names
- File::Spec::Mac (1.2) - File::Spec for MacOS
- File::Spec::OS2 (1.1) - methods for OS/2 file specs
- File::Spec::Unix (1.2) - methods used by File::Spec
- File::Spec::VMS - methods for VMS file specs
- File::Spec::Win32 (1.2) - methods for Win32 file specs
- ExtUtils::Command (1.01) - utilities to replace common UNIX commands in Makefiles etc.
- ExtUtils::Embed (1.2505) - Utilities for embedding Perl in C/C++ applications
- ExtUtils::Install (1.28) - install files from here to there
- ExtUtils::Installed (0.02) - Inventory management of installed modules
- ExtUtils::Liblist - determine libraries to use and how to use them
- ExtUtils::MM_Cygwin - methods to override UN*X behaviour in
- ExtUtils::MakeMaker
- ExtUtils::MM_OS2 - methods to override UN*X behaviour in ExtUtils::MakeMaker
- ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker
- ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker
- ExtUtils::MM_Win32 - methods to override UN*X behaviour in
- ExtUtils::MakeMaker
- ExtUtils::MakeMaker (5.45) - create an extension Makefile
- ExtUtils::Manifest (1.33) - utilities to write and check a MANIFEST file
- ExtUtils::Miniperl - write the C code for perlmain.c
- ExtUtils::Mkbootstrap (1.14) - make a bootstrap file for use by DynaLoader
- ExtUtils::Mksymlists (1.17) - write linker options files for dynamic extension
- ExtUtils::Packlist (0.03) - manage .packlist files
- ExtUtils::testlib (1.11) - add blib/* directories to @INC
- Exporter::Heavy - Exporter guts
- Devel::SelfStubber (1.01) - generate stubs for a SelfLoading module
- Class::Struct (0.59) - declare struct-like datatypes as Perl classes
- Carp::Heavy - Carp guts
- CGI::Apache - Backward compatibility module for CGI.pm
- CGI::Carp (1.20) - CGI routines for writing to the HTTPD (or other) error log
- CGI::Cookie (1.18) - Interface to Netscape Cookies
- CGI::Fast - CGI Interface for Fast CGI
- CGI::Pretty (1.05) - module to produce nicely formatted HTML code
- CGI::Push (1.04) - Simple Interface to Server Push
- CGI::Switch - Backward compatibility module for defunct CGI::Switch
- CGI::Util (1.1) - Internal utilities used by CGI module
You can get more information on these modules from the Comprehensive Perl Archive Network (CPAN) site at http://www.cpan.org.
Can I install my own PERL modules
Not easily, no.
We will be adding functionality to our machines on a regular basis, so will likely be able to install some modules for you when we do this. Some modules we will not install for security reasons, but if you do have any requests please post them to the blueyonder.discussion.pwp newsgroup and we will consider adding them for you.