Knowledge base: Using Perl
- What is Perl?
- What version of Perl do you run on your service?
- What is the Path to Perl?
- Do my Perl scripts need to be named a certain way to work?
- Will my scripts work anywhere or do I need to place them in a cgi-bin directory?
- My script is causing an "Internal Server Error" when I try to run it. What's wrong?
- My script needs to use Sendmail. Can I use it and what's the path?
- Do you have any standard CGI scripts for use on my site?
- Where can I get good Perl scripts for my web site?
- What are the best places and ways to learn more about Perl?
-
What is Perl?
Perl is the most popular scripting language in the world. The multiplatform language is highly suited to processing and managing text, connecting to web services, updating databases and doing pretty much anything else that requires moving data around. It is by far the most popular language for CGI scripts and has an extraordinary scope: from simple mailform handlers to complex database management systems, Perl handles it all with aplomb and even wit. Whatever you throw at it, the Practical Extraction and Reporting Language (or the Pathalogically Eclectic Rubbish Lister, as its author has also called it) will do the job quickly and efficiently in a way that other more buzzword compliant technologies can only dream of.
-
What version of Perl do you run on your service?
All our servers run Perl 5, latest stable release.
-
What is the Path to Perl?
#!/usr/bin/perl
-
Do my Perl scripts need to be named a certain way to work?
Yes, all Perl scripts need to be named with either a .cgi or a .pl extension. For example myfile.cgi or myfile.pl
-
Will my scripts work anywhere or do I need to place them in a cgi-bin directory?
You aren't limited to a cgi-bin directory for your scripts on our service. You can place your CGI scripts anywhere within your web space. Most people prefer to group their scripts into a directory called 'cgi' or 'scripts' within their public_html folder, but you can put them anywhere within your public_html folder or sub-folders thereof. If you do need a cgi-bin for any legacy scripts that require this, then simply create a folder called cgi-bin in your public_html directory.
-
My script is causing an "Internal Server Error" when I try to run it. What's wrong?
All Perl scripts on our server must have the correct permissions - either 755 or 700 - in order to run. Make sure the permissions are set correctly and your user is the owner of the script.
Additionally, all Perl scripts MUST be uploaded to the server by FTP using ASCII transfer mode. If they aren't, the scripts will fail and should be reuploaded.
For further information on running CGI scripts on our service, please see our CGI Guide.
-
My script needs to use Sendmail. Can I use it and what's the path?
Our servers all use Qmail for the security and performance improvements this offers over Sendmail. But, Qmail fully emulates Sendmail and so it is perfectly OK to leave your scripts calling Sendmail directly. The path to Sendmail is:
/usr/sbin/sendmail
-
Do you have any standard CGI scripts for use on my site?
A few. Primarily our standard formmail script, allowing information to be emailed to you from HTML forms on your web site. You can download this from our Downloads Page complete with instructions.
We don't provide many other standard scripts, because in our experience everyone has quite differing needs. However, our support team are more than happy to recommend scripts for certain tasks (guestbooks, search scripts, web forums etc) if you ask and can point you in the right direction.
-
Where can I get good Perl scripts for my web site?
A good place to start looking for Perl scripts are the following sites which list an enormous number of freeware, shareware and commercial scripts covering all sorts of applications:
CGI Resource Index http://cgi.resourceindex.com/Programs_and_Scripts/Perl
Open Source Development Network http://www.freshmeat.net -
What are the best places and ways to learn more about Perl?
O'Reilly publish a wide range of excellent books on Perl which are widely regarded as the definitive reference for Perl. See here for the range on the O'Reilly web site.
There are also a huge number of very useful web sites dedicated to learning and using Perl. Some that we would recommend are:
perl.com http://www.perl.com
Perl Mongers http://www.perl.org
Learn Perl http://learn.perl.org
Use Perl http://use.perl.org
Active State (for Windows) http://www.activestate.com
MacPerl (for Macintosh) http://www.macperl.com
CGI Resource Index http://cgi-resources.com