ActivePerl

No sendmail on Windows -- use Mail::Sender

Question: 

My perl program uses sendmail. How do I run it on a Windows system?

Answer: 

Sendmail is a mail transfer agent used on many UNIX systems. Perl programs (such as FormMail by Matthew Wright) often use it as a pipe for sending messages. Sendmail is not part of ActivePerl, and isn't typically installed on Windows.

The best approach to use when writing Perl scripts that need to send email and also need to work on both UNIX and Windows systems is to use the Mail::Sender modules instead as this is available on Windows and UNIX. You can install Mail::Sender by running:

  ppm install mail-sender

...at a command prompt. Documentation for using Mail::Sender is available here:

http://search.cpan.org/~jenda/Mail-Sender-0.8.16/Sender.pm

Map CGI Extension in IIS

Question: 

How do I get IIS to use ActivePerl for my CGI scripts?

Answer: 

During installation, ActivePerl creates script mappings in IIS for the .pl and .plx extensions but not the .cgi extension. To support the .cgi file extension, you will need to replicate the .pl extension settings.

  1. Go to Control Panel | Administrative Tools
  2. Open Internet Information Services
  3. Right-click the Default web site and select Properties.
  4. In the Properties dialog-box select the 'home Directory' tab.
  5. Click on the configuration button in the Application Configuration dialog.
  6. Click on the 'Add' button.

In the Add/Edit dialog-box, ensure the following settings are correct:

  • for executable, put in C:\Perl\bin\perl.exe "%s" %s ( adjust this if you have installed Perl elsewere)
  • for the extension, enter 'cgi'
  • for Verbs, select 'Limit to:' and put in 'GET,HEAD,POST'
  • select 'Script Engine' and 'Check that file exists'

Click OK to close all of the open dialog-boxes. You should now be able to place the cgi files you want to run into the wwwroot folder (usually c:\inetpub\wwwroot\), or create a virtual web directory in IIS to the location of your cgi files.

Manual Uninstall of ActivePerl

Question: 

How do I manually uninstall ActivePerl (on Windows)?

Answer: 

To remove ActivePerl manually, delete the \Perl\ directory (including all sub-directories) and the following registry entries:

  1. HKEY_LOCAL_MACHINE/Software/ActiveState/ActivePerl
  2. HKEY_LOCAL_MACHINE/Software/ActiveState/PerlScript
  3. HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/
    Uninstall/ActivePerl

InstMSIW.exe is NOT the perl installer

Question: 

I've run InstMSIW.exe, but ActivePerl doesn't seem to be installed.
What's wrong?

Answer: 

InstMsiW.exe and InstMsiA.exe are patches for older versions of Windows to allow them to use our MSI installers. People often mistake this download for the ActivePerl installer itself, which can be found on the left-hand side of the download page:

http://www.activestate.com/activeperl/downloads

Select the link under 'Windows' for the MSI installer.

IE6 on XP SP2 won't display HTML docs installed by ppm.

Question: 

I can't see any HTML documentation for installed packages (Windows XP SP2). Why?

Answer: 

This is a known issues with Internet Explorer 6 on Windows XP
(Service Pack 2). The documentation for modules installed using PPM will
not display because of security settings in IE. To regenerate your docs
so that they will be properly displayed:

  • Delete the HTML documentation for perl-ldap in C:\Perl\docs\
  • Run the following at the command line:
        perl -MActivePerl::DocTools -e ActivePerl::
    DocTools::UpdateHTML()

ActivePerl for HP-UX

Question: 

Where can I find ActivePerl for HP-UX?

Answer: 

Current versions of ActivePerl for HP-UX are available with a Business Edition License.

http://www.activestate.com/business_edition/

Finding @INC

Question: 

How can I find out which directories are in @INC?

Answer: 

@INC is a special variable which contains the directories perl looks through for files included through use, require or do statements. To see which directories are in @INC, run the following at the command-line:

    perl -e "foreach (@INC){print $_.\"\n\"}"

ActivePerl and Apache CGI config

Question: 

How do I configure Apache to use ActivePerl for CGI?

Answer: 

To configure appache to use ActivePerl for CGI:

  1. Edit your httpd.conf file. You can open this file by selecting
    Start | Programs | Apache HTTP Server | Configure Apache Server
    | Edit the Apache httpd.conf Configuration File
    which will open
    httpd.conf file in the notepad editor.
  2. Search for "DocumentRoot". You should see a section that looks like this:

    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "C:/apacheroot"

  3. Change the value of DocumentRoot to the actual local path to your web site.
    Make sure you use '/' forward slashes in the path. Apache doesn't understand
    '\' backward slashes in paths.
  4. Just below the DocumentRoot section you will see the main directory section:
    Options FollowSymLinks
    AllowOverride None
    

    on the Option line, add "ExecCGI":

    Options FollowSymLinks ExecCGI
    
  5. Search for the line:
    #AddHandler cgi-script .cgi
    

    Remove the '#' at the beginning to uncomment this line.

    AddHandler cgi-script .cgi
    

    If you want to use the .pl extension for your CGI scripts, change the extension
    so that the line looks like this:

    AddHandler cgi-script .pl
    
  6. Save and close httpd.conf.

  7. Restart the Apache service using the Apache Service
    Monitor
    .
  8. Test your configuration by placing the following test script in your
    DocumentRoot directory as 'test.pl' (or test.cgi). Open the
    local URL http://localhost/test.pl in your browser.

    The test script:

    #!c:\perl\bin\perl.exe
    # ^^^ this must be the first line of the script! ^^^
    # start code

    use strict;
    use CGI;
    my $q = new CGI;

    # print header and start the markup output

    print $q->header( "text/html" ),$q->start_html( "hello from perl cgi!" );
    print $q->h2("Hello World!");
    print $q->end_html;
    # end code

Manually creating IIS script mappings

Question: 

How can I manually create IIS script mappings for ActivePerl?

Answer: 

To manually create IIS script mappings for ActivePerl:

  1. Go to Control Panel | Administrative Tools
  2. Open Internet Information Services
  3. Right-click the Default web site and select Properties.
  4. In the Properties dialog-box select the 'home Directory' tab.
  5. Click on the configuration button in the Application Configuration dialog.
  6. Click on the 'Add' button.

In the Add/Edit dialog-box, ensure the following settings are correct:

  • for executable, put in C:\Perl\bin\perl.exe "%s" %s ( adjust this if you have installed Perl to a different directory )
  • for the extension, put in 'pl'
  • for Verbs, select 'Limit to:' and put in 'GET,HEAD,POST'
  • select 'Script Engine' and 'Check that file exists'

For PerlIs ISAPI support, repeat these step using
'C:\Perl\bin\perlis.dll' for the executable field and
'plx' for the extension.

ActivePerl Blurb

ActivePerl is ActiveState's award-winning distribution of Perl, available for Windows, Mac OS X, Linux, Solaris, HP-UX, and AIX. ActivePerl includes the PPM package manager which allows you to easily install CPAN modules.

Quick links: