Using Perl

Details for running Perl scripts on our shared servers.

 




Installing your own perl/cgi scripts

 


CGI folder name

 

The first step to installing a cgi script is to upload the script into your account. It doesn't matter where you place the script, it will execute properly from any directory. However, creating a directory called scripts may help you keep some order to your files.

 

Please note: You can not call your cgi folder cgi-bin. This is the name of our cgi folder and any request from your web page for a directory called cgi-bin will result in a 404/file not found error.

 

 

File extensions

 

Make sure the files have the correct .cgi file extension. A .html extension will not work. Some custom scripts may have a .pl extension, that's ok, but note, if you are calling a script from a page on your website, you must rename the file and give it that .cgi extension. If you attempt to call a script with a .pl extension from your website you will receive a Method not allowed error.

 

 

Uploading scripts

 

When uploading your scripts, please make sure that you upload in ASCII mode. If you mistakenly upload your scripts in Binary format, invisible characters may be saved with in the script itself. If this occurs you will get a 500 Internal Server Error message when you attempt to run the script.

 

 

File permissions

 

You will also need to make sure that your scripts have the correct file permissions. You may alter the permissions on any file or folder in the file manager of your /admin area. Your scripts must be executable. Try the numerical value 755. It is also important to check on the permissions of the directory holding your cgi scripts. If a directory is either group or world writable, this may lead to a potential security hole, and the script will not execute. The ideal settings for a directory is the octal value 711. If the permission on your scripts or your cgi directory are set incorrectly, you will receive a 500 Internal Server Error message.

 

 

Command locations

 


The Location of Perl

 

The first line of ALL cgi scripts should read:

#!/usr/bin/perl

 

That said, the the path to Perl is:

/usr/bin/perl

 

If you are having problems executing the script, it could be do to invisible characters surrounding the above line. This is caused most often when saving files in windows with line feeds or when uploading scripts through FTP in binary format. The best way to clear up this problems is to delete the first line and rewrite it.

 

 

Your account's pathname

 

Should you need to supply a script with your "home directory", "base directory" or "full server path", the value that you enter should look like this:

/nfs/new/your_user

 

 

The location of the mail command

 

The mail command may be found at:

/bin/mail

 

The sendmail command is located at:

/usr/lib/sendmail

 

 

The location of the date command

 

The date command may be found at:

/bin/date

 

 

Installed Perl Modules

 

PLEASE NOTE: the list below is incomplete, so if you do not see the module you'd like, please use contact us.

 

Apache::Filter
Apache::Mason
Apache::PerlRunFilter
Apache::RegistryFilter
Archive::Tar
AutoLoader
AutoSplit
B
B::Asmdata
B::Assembler
B::Bblock
B::Bytecode
B::C
B::CC
B::Debug
B::Deparse
B::Disassembler
B::Lint
B::Showlex
B::Stackobj
B::Terse
B::Xref
Benchmark
Bundle::HTML::Mason
Bundle::LWP
Business::CreditCard
CDDB
CGI
CGI::Apache
CGI::Carp
CGI::Cookie
CGI::Fast
CGI::Pretty
CGI::Push
CGI::Switch
CGI::Util
CPAN
CPAN::Config
CPAN::FirstTime
CPAN::Nox
CPAN::foo
Cache::BaseCache
Cache::BaseCacheTester
Cache::Cache
Cache::CacheMetaData
Cache::CacheSizer
Cache::CacheTester
Cache::CacheUtils
Cache::FileBackend
Cache::FileCache
Cache::MemoryBackend
Cache::MemoryCache
Cache::NullCache
Cache::Object
Cache::SharedMemoryBackend
Cache::SharedMemoryCache
Cache::SizeAwareCache
Cache::SizeAwareCacheTester
Cache::SizeAwareFileCache
Cache::SizeAwareMemoryCache
Cache::SizeAwareSharedMemoryCache
Carp
Class::Container
Class::Data::Inheritable
Class::Struct
Config
Cwd
DBIx::EasySearch
DBIx::Handle
DBIx::Record
DBIx::SearchBuilder
DBIx::SearchBuilder/Handle::Oracle
DBIx::SearchBuilder/Handle::Pg
DBIx::SearchBuilder/Handle::mysql
DBIx::SearchBuilder::Handle
DBIx::SearchBuilder::Record
DB_File
Data::Dumper
Data::ShowTable
Date::Range
Date::Simple
Devel::SelfStubber
Devel::StackTrace
Digest
Digest::base
DirHandle
Dumpvalue
DynaLoader
English
Env
Errno
Error
Exception::Class
Exporter
ExtUtils::Command
ExtUtils::Embed
ExtUtils::Install
ExtUtils::Installed
ExtUtils::Liblist
ExtUtils::MM_OS2
ExtUtils::MM_Unix
ExtUtils::MM_VMS
ExtUtils::MM_Win32
ExtUtils::MakeMaker
ExtUtils::Manifest
ExtUtils::Miniperl
ExtUtils::Mkbootstrap
ExtUtils::Mksymlists
ExtUtils::Packlist
ExtUtils::testlib
Fatal
Fcntl
File::Basename
File::CheckTree
File::Compare
File::Copy
File::DosGlob
File::Find
File::Listing
File::NCopy
File::Path
File::Spec
File::Spec::Functions
File::Spec::Mac
File::Spec::OS2
File::Spec::Unix
File::Spec::VMS
File::Spec::Win32
File::Temp
File::stat
FileCache
FileHandle
FindBin
FreezeThaw
GDBM_File
Getopt::Long
Getopt::Std
HTML::Form
HTML::Mason
HTML::Mason/Cache::BaseCache
HTML::Mason/Compiler::ToObject
HTML::Mason/Component::FileBased
HTML::Mason/Component::Subcomponent
HTML::Mason/Resolver::File
HTML::Mason/Resolver::Null
HTML::Mason::ApacheHandler
HTML::Mason::Buffer
HTML::Mason::CGIHandler
HTML::Mason::Commands
HTML::Mason::Compiler
HTML::Mason::Component
HTML::Mason::ComponentSource
HTML::Mason::Config
HTML::Mason::Escapes
HTML::Mason::Exceptions
HTML::Mason::FakeApache
HTML::Mason::Interp
HTML::Mason::Lexer
HTML::Mason::MethodMaker
HTML::Mason::Parser
HTML::Mason::Preview
HTML::Mason::Request
HTML::Mason::Resolver
HTML::Mason::Tests
HTML::Mason::Tools
HTML::Mason::Utils
HTML::Tagset
HTML::Template
HTTP::Cookies
HTTP::Cookies::Microsoft
HTTP::Cookies::Netscape
HTTP::Daemon
HTTP::Date
HTTP::Headers
HTTP::Headers::Auth
HTTP::Headers::ETag
HTTP::Headers::Util
HTTP::Message
HTTP::Negotiate
HTTP::Request
HTTP::Request::Common
HTTP::Response
HTTP::Status
I18N::Collate
IO
IO::AtomicFile
IO::File
IO::Handle
IO::InnerFile
IO::Lines
IO::Pipe
IO::Scalar
IO::ScalarArray
IO::Seekable
IO::Select
IO::Socket
IO::String
IO::Stringy
IO::Wrap
IO::WrapTie
IPC::Msg
IPC::Open2
IPC::Open3
IPC::Semaphore
IPC::SysV
Image::Info
Image::Info::BMP
Image::Info::GIF
Image::Info::JPEG
Image::Info::PNG
Image::Info::PPM
Image::Info::SVG
Image::Info::XBM
Image::Info::XPM

Image::Magick

Image::Size 

Image::TIFF
LWP
LWP::Authen::Basic
LWP::Authen::Digest
LWP::Authen::Ntlm
LWP::ConnCache
LWP::Debug
LWP::DebugFile
LWP::MediaTypes
LWP::MemberMixin
LWP::Protocol
LWP::Protocol::GHTTP
LWP::Protocol::cpan
LWP::Protocol::data
LWP::Protocol::file
LWP::Protocol::ftp
LWP::Protocol::gopher
LWP::Protocol::http
LWP::Protocol::http10
LWP::Protocol::https
LWP::Protocol::https10
LWP::Protocol::mailto
LWP::Protocol::nntp
LWP::Protocol::nogo
LWP::RobotUA
LWP::Simple
LWP::UserAgent

MD5
MIME::Body
MIME::Decoder
MIME::Decoder::Base64
MIME::Decoder::Binary
MIME::Decoder::Gzip64
MIME::Decoder::NBit
MIME::Decoder::QuotedPrint
MIME::Decoder::UU
MIME::Entity
MIME::Field::ConTraEnc
MIME::Field::ContDisp
MIME::Field::ContType
MIME::Field::ParamVal
MIME::Head
MIME::Parser
MIME::Parser::Filer
MIME::Parser::Reader
MIME::Parser::Results
MIME::Tools
MIME::WordDecoder
MIME::Words
MP3::ID3v1Tag
MP3::Info
MPEG::ID3v1Tag
MPEG::MP3Info
Mail::Address
Mail::Alias
Mail::Bulkmail
Mail::Bulkmail::DummyServer
Mail::Bulkmail::Dynamic
Mail::Bulkmail::Object
Mail::Bulkmail::Server
Mail::Cap
Mail::Field
Mail::Field::AddrList
Mail::Field::Date
Mail::Filter
Mail::Header
Mail::Internet
Mail::Mailer
Mail::Mailer::mail
Mail::Mailer::rfc822
Mail::Mailer::sendmail
Mail::Mailer::smtp
Mail::Mailer::test
Mail::Send
Mail::SpamAssassin
Mail::SpamAssassin/SMTP::SmartHost
Mail::SpamAssassin::AuditMessage
Mail::SpamAssassin::AutoWhitelist
Mail::SpamAssassin::Conf
Mail::SpamAssassin::ConfSourceSQL
Mail::SpamAssassin::DBBasedAddrList
Mail::SpamAssassin::DirBasedAddrList
Mail::SpamAssassin::Dns
Mail::SpamAssassin::EncappedMessage
Mail::SpamAssassin::EvalTests
Mail::SpamAssassin::ExposedMessage
Mail::SpamAssassin::Locales
Mail::SpamAssassin::Message
Mail::SpamAssassin::MyMailAudit
Mail::SpamAssassin::NoMailAudit
Mail::SpamAssassin::PerMsgStatus
Mail::SpamAssassin::PersistentAddrList
Mail::SpamAssassin::PhraseFreqs
Mail::SpamAssassin::Replier
Mail::SpamAssassin::Reporter
Mail::Util
Math::BigFloat
Math::BigInt
Math::Complex
Math::Trig
Mon::Client
Mon::Protocol
Mon::SNMP
NDBM_File
Net::DNS
Net::DNS/RR::A
Net::DNS/RR::AAAA
Net::DNS/RR::AFSDB
Net::DNS/RR::CNAME
Net::DNS/RR::EID
Net::DNS/RR::HINFO
Net::DNS/RR::ISDN
Net::DNS/RR::LOC
Net::DNS/RR::MB
Net::DNS/RR::MG
Net::DNS/RR::MINFO
Net::DNS/RR::MR
Net::DNS/RR::MX
Net::DNS/RR::NAPTR
Net::DNS/RR::NIMLOC
Net::DNS/RR::NS
Net::DNS/RR::NSAP
Net::DNS/RR::NULL
Net::DNS/RR::PTR
Net::DNS/RR::PX
Net::DNS/RR::RP
Net::DNS/RR::RT
Net::DNS/RR::SOA
Net::DNS/RR::SRV
Net::DNS/RR::TXT
Net::DNS/RR::X25
Net::DNS::Header
Net::DNS::Packet
Net::DNS::Question
Net::DNS::RR
Net::DNS::Resolver
Net::DNS::Update
Net::HTTP
Net::HTTP::Methods
Net::HTTP::NB
Net::HTTPS
Net::Ping
Net::hostent
Net::netent
Net::protoent
Net::servent
O
ODBM_File
Opcode
POSIX
Pod::Checker
Pod::Find
Pod::Functions
Pod::Html
Pod::InputObjects
Pod::ParseUtils
Pod::Parser
Pod::PlainText
Pod::Select
Pod::Text
Pod::Usage
SDBM_File
Safe
Search::Dict
SelectSaver
SelfLoader
Shell
Shout
Socket
Storable
Symbol
Sys::Hostname
Sys::Syslog
Term::Cap
Term::Complete
Term::ReadLine
Test
Test::Builder
Test::Harness
Test::More
Test::Simple
Text::Abbrev
Text::ParseWords
Text::Soundex
Text::Tabs
Text::Template
Text::Wrap
Text::Wrapper
Tie::Array
Tie::Handle
Tie::Hash
Tie::RefHash
Tie::Scalar
Tie::SubstrHash
Time::Local
Time::Object
Time::Seconds
Time::gmtime
Time::localtime
Time::tm
UNIVERSAL
URI
URI::Escape
URI::Heuristic
URI::QueryParam
URI::Split
URI::URL
URI::WithBase
URI::_foreign
URI::_generic
URI::_login
URI::_query
URI::_segment
URI::_server
URI::_userpass
URI::data
URI::file
URI::ftp
URI::gopher
URI::http
URI::https
URI::ldap
URI::mailto
URI::news
URI::nntp
URI::pop
URI::rlogin
URI::rsync
URI::rtsp
URI::rtspu
URI::sip
URI::sips
URI::snews
URI::ssh
URI::telnet
URI::tn3270
URI::urn
User::grent
User::pwent
WWW::RobotRules
WWW::RobotRules::AnyDBM_File
attrs
autouse
base
blib
constant
diagnostics
fields
integer
less
lib
locale
ops
overload
re
sigtrap
strict
subs
vars

 

 

 

Editing your scripts

 

 

Line Wrapping

 

Once uploaded into your account, you may use your file manager's editor to make changes to your custom scripts. This is important: When editing perl scripts make sure that you have wrapping turned OFF This will help insure that the syntax of you perl script remains intact while you are editing. You can turn wrapping on and off in the /admin area under Options and then Password and Interface. If you leave wrapping on without fail you will receive a 500 Internal Server error when you run the script.

 

 

The perl checker

 

Once you are done editing, you may want to check that the perl syntax is in good shape. You will notice that your text editor has the option of Check Perl Syntax The perl checker tests for syntax errors in your perl code. Ideally you will receive a message that says syntax ok If there are syntax errors with in your script you will receive some frightfully vague error messages. We didn't write this program so cant help that part. Vague as these error messages may be, they generally do include a line number, so you are often pointed in the right direction for trouble shooting. If you take a look and cannot understand what the perl checker is saying, send us a note with the error and the name of the script in question and we will take a look. As always. please include your account username in your correspondence.

 

 



Common error messages

 

 

File not found (404)

 

Make sure your cgi directory is not called cgi-bin. This is the name of our cgi folder. try the name "cgi", scripts", "cgibin" or "cgi_bin"

 

Double check the url or path you use to call your script. Are you reference the correct location and file name? Please remember that location and file names on our servers are case sensitive.

 

 

Method post not allowed


Make sure that the script you are calling has a .cgi file extension.

 

 

500 Internal Server Error

 

This is a toughie. There are countless reason for this error. There are just a few things to keep in mind:

 

- Make sure that the first line of any perl script reads #!/usr/bin/perl

 

- Make sure that your scripts are uploaded in ASCII format

 

- Check your file permissions. Files should be set to 755, your scripts directory to 711

 

- All cgi scripts need to print a content type. If you have a pre written script, it will must likely include this command, but if you are writing you own please make sure that you include the following line:

 

 print "Content-type: text/htmlnn";

 

- Make sure there are not syntax errors in your script. Make sure you have wrapping in your file manager editor turned off (see above instructions) and run a perl check. See if you get any errors.

 

- And finally, despite a "syntax ok" message form the perl checker, there may simply be errors in the code. Drop us a note with the following information:

 

  • Your account username
  • Your account domain name
  • The location of the file in your account
  • The HTML page that calls the script

 

and we will take a look at it for you.

  • 17 Users Found This Useful
Was this answer helpful?

Related Articles

PHP

Details on our PHP installations, as well as links to PHP resources.   What is PHP? PHP File...

Server Side Includes (SSI)

Covers what is required to use Server Side Includes in your account, some sample SSI code, and...

Using the .htaccess File

A breif tutorial on how to use the .htaccess file to set up custom (404) error pages, redirect...