The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

INSTALLATION

UNIX

To install on unix perform the following steps:

Unpack the archive
perl Makefile.PL

You will be asked if you want to compile in support for Apache mod_perl. If you say yes, the source of Apache is searched (for headerfiles). If it can't found, please specify the basepath. Please make sure mod_perl is already installed. If you have installed mod_perl-0.96 or higher, Makefile.PL automatically suggests the same source path as was used to build mod_perl.

make
make test
make install

NOTE 1: For using session handling you need Apache::Session 1.53 and Apache::SessionX 2.00b3 or higher.

NOTE 2: Embperl runs without additional Perl modules, but the make test needs the following modules to work:

  • URI

  • MIME::Base64

  • HTML::Parser

  • HTML::HeadParser

  • Digest::MD5

  • libnet

  • libwww

  • libwin32 (only Win32)

NOTE 3: EmbperlObject needs the following modules to work:

  • File::Spec 0.8 or higher

If you have already successfully build and tested mod_perl all modules will already be there.

Options for make test

make test can take several options, which can be given with the TESTARGS parameter:

  make test TESTARGS="--help"

will show you a list of available option. Most of them you will never need, they are mainly nesseccary for debugging Embperl itself.

XML and XSLT support

Starting with Embperl 2.0b4 it has a build in XSLT support. You can either use the Apache Xerces-C and Xalan-C and/or Gnome libxml and libxslt. Embperl is currently tested with Xalan 1.2 and libxslt 1.0.4.

To install Xalan, download the Xalan archive for your OS from http://xml.apache.org/dist/xalan-c/

For Linux it is Xalan-C_1_2-linux.tar.gz For Solaris it is Xalan-C_1_2-solaris.tar.gz

Extract the archive and make the shared libraries available to the system, either by adding the directories to LD_LIBRARY_PATH or by coping them to a library directory, e.g. /usr/local/lib and run ldconfig -v. The two ncessary libraries can be found under

    xerces-c1_5_1-linux/lib/libxerces-c1_5_1.so
    xml-xalan/c/lib/libxalan-c1_2.so

Now you only have to enter the basepath of where you have extraced the Xalan archive, when Makefile.PL asks you for it and proceed as normal.

NOTE: For special hints on compiling XALAN see below

To use libxml/libxslt, download them from http://xmlsoft.org/ and install them on your system. Makefile.PL will automaticly detect the installed libraries and linked them into Embperl. (you have to make sure that xml2-config and xslt-config can be found and run by Makefile.PL)

Debian packages

The Debian packages "libhtml-embperl-perl" and "libembperl-perl" are maintained by Angus Lees and are available from the usual Debian mirrors.

UNIX (without Apache Source)

If you have an UNIX with preinstalled Apache and mod_perl (e.g. a Linux distribution), you need to locate the following files on your disk:

httpd.h
httpd
mod_env.so

For example in SuSE Linux 7.1 they could be found at

/usr/include/apache/httpd.h
/usr/sbin/httpd
/usr/lib/apache/mod_env.so

Now go to the Embperl directory and start

perl Makefile.PL

When get asked for the Apache sources, enter the directory where you found httpd.h (e.g. /usr/include/apache). For the Apache executable enter the path to httpd. If the Apache modules are loaded dynamicly, the you will get ask for mod_env.so, enter it's directory. Now you can continue as normal with

make test
make install

Win32 (non ActiveState Perl)

NOTE: You need mod_perl >= 1.12 on win32

On Windows 95/NT you have to do the following:

perl Makefile.PL
nmake

(you must have the c compiler in your path) if you get an error about compiling Embperl.c. Edit Embperl.c and change

-#line "Embperl.xs"

to

+#line 1 "Embperl.xs"

now re-run nmake and it should compile.

nmake test

NOTE: nmake test needs libwin32, libwww and HTML::Parser installed to work

nmake install

NOTE 1: For using session handling you need Apache::Session 1.53 and Apache::SessionX 2.00b3 or higher.

NOTE 2: Embperl runs without additional Perl modules, but the make test needs the following modules to work:

  • URI

  • MIME::Base64

  • HTML::Parser

  • HTML::HeadParser

  • Digest::MD5

  • libnet

  • libwww

  • libwin32 (only Win32)

NOTE 3: EmbperlObject needs the following modules to work:

  • File::Spec 0.8 or higher

If you have already successfully build and tested mod_perl all modules will already be there.

Win32 with ActiveState Perl and Apache 1.3.x

First get and install ActiveState Perl from http://www.activestate.com/

You can skip the installation of Apache and mod_perl, if you only want to use Embperl offline or as CGI.

Next get the Apache binary (including the source e.g. apache_1.3.31-win32-x86-src.msi) from http://www.apache.org/dist/httpd/binaries/win32/ or a mirror. (You may need to install the windows MSI installer from the same page too, and be sure to read the README at the end of the file list for further requirements of some windows versions, especially Windows 95 and XP). Now run the installation.

Then install mod_perl. How to do this is described very detailed at http://perl.apache.org/docs/1.0/os/win32/install.html#PPM_Packages

In this file, you'll find a short summary of that page.

There are two ways to install mod_perl:

+ Easy version:

  Download the perl script
  http://perl.apache.org/docs/1.0/os/win32/mpinstall and execute it
  with "perl mpinstall". It will interactively install you the right
  mod_perl version.

+ Manual installation:

  Run the ppm program to install mod_perl

  - If you have Perl 5.8.x:

    ppm install http://theoryx5.uwinnipeg.ca/ppms/mod_perl-1.ppd

  - If you have Perl 5.6.x:

    ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/mod_perl.ppd


  If you get asked for the Apache directory, enter the C<modules>
  subdirectory under the path where you have installed your Apache,
  e.g.

    \Program Files\Apache Group\Apache\modules

As last step you can install the Embperl ppd:

+ If you have Perl 5.8.x:

    ppm install http://theoryx5.uwinnipeg.ca/ppms/Embperl-1.ppd

  This is an Embperl 2 ppd, the "-1" at the end of the package name
  denotes that this ppd is for mod_perl 1.x. There is no Embperl 1 ppd
  for Perl 5.8.x (yet).

+ If you have Perl 5.6.x:

  - Embperl 1:

    ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/HTML-Embperl.ppd

  - Embperl 2:

    ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Embperl.ppd

Compile Embperl from the sources on Win32 with ActiveState Perl

First install ActiveState Perl, Apache and mod_perl as described above. Make sure you have an Apache version which includes the sources. (Of course when you want to use Embperl only offline or as CGI you don't have to install Apache and mod_perl)

Then extract the Embperl distribution and go to the directory where you have extracted Embperl. Start

  perl Makefile.PL

Enter y or hit enter when you get ask "Build with support for Apache mod_perl?(y/n) [y]" When get asked for the Apache source enter the Apache directory you have installed above. e.g. \Program Files\Apache Group.

Now you can continue by running

  nmake test
  nmake install  

Win32: Install Apache and non Apache version on the same system

Unlike Unix, Windows loads any needed DLL (dynamic libraries) at startup. This causes trouble when Embperl is compiled for use with Apache and mod_perl, but is used outside of Apache, because Windows tries to load ApacheCore.dll. To solve this problem Embperl 1.3.4+ can install a Apache and a non Apache version. To do this first install the Apache version as decribed above (includeing the nmake install) . Afterwards rerun Makefile.PL, when ask for mod_perl support answer no, now Makefile.PL detects that a mod_perl version was already compiled and asks if you what a separte non Apache version. Just say yes here and compile and install this version too. When Embperl is loaded it detects if runs in- or outside of Apache and loads the correct library.

Win32: Apache 2.0

Embperl currently does not support Apache 2.0 on Windows (on UNIX is does). This is due to the fact the Embperl is not fully thread safe yet. Makeing Embperl thread safe and support for Apache 2.0 on Windows, is currently under development.

How to continue

IMPORTANT: Before using Embperl 2.0, make sure you have read the README.v2. The documentation is only partially updated to 2.0 yet!!

You can view the documentation at any time from the Embperl source directory, by using the following commands metioned below. After the installation you can also view documention by specifying the full module name: e.g.

perldoc Embperl, perldoc Embperl::Intro etc.

To get familiar how Embperl works, read the "Intro" and "IntroEmbperlObject" documents. To learn how to use and configure Embperl, read the "Embperl documentation".

Further Documentation

See "perldoc Features" for list of Embperls features

See "perldoc Intro" for an step by step introduction to Embperl.

See "perldoc IntroEmbperlObject" for an step by step introduction to the OO features of Embperl.

See "perldoc IntroEmbperl2.pod" for Introduction to Embperl 2 advanced features.

See "perldoc Config" for configuration and calling Embperl.

See "perldoc Embperl" for complete documentation.

See "perldoc TipsAndTricks" for Tips and Tricks around Embperl.

or you can view it online on http://perl.apache.org/embperl/ and http://www.ecos.de/embperl/

Compiling XALAN

Normaly you should be fine with the binary packages that are provided for XALAN. If you want to compile XALAN from the sources there should be normaly no problem as long as you use GNU gcc on Unix or Microsoft VC++ on Windows.

Here are some hints how to compile XALAN 1.2 with the sun C++ 5.1:

  • Get the sources for XERCES and XALAN

  • Untar the files

    Use GNU tar, solaris tar doesn't work! GNU tar can be found at ftp://ftp.mcc.ac.uk/pub/gnu/tar/tar-1.13.tar.gz

  • Set the root directories

        export XERCESCROOT=/path/to/xerces-c-src1_5_1
        export XALANCROOT=/path/to/xml-xalan/c
  • Compile XERCES

        cd xerces-c-src1_5_1/src
        sh runConfigure -p solaris -c cc -x CC
        make
  • Patch XALAN

    There must be one typecast inserted in the following three files:

     "c/src/XSLT/ExtensionFunctionHandler.cpp", line 156
     156c156
     < return m_functions.find(function) != m_functions.end();
     ---
     > return StringSetType::const_iterator(m_functions.find(function)) != m_functions.end();
    
     "c/src/XSLT/ExtensionNSHandler.cpp", line 200
     200c200
     < return (m_elements.find(element) != m_elements.end());
     ---
     > return (ExtensionSetType::const_iterator(m_elements.find(element)) !=  m_elements.end());
    
     "c/src/XSLT/NamespacesHandler.cpp", line 366
     366c366
     < || m_extensionNamespaceURIs.find(theURI) != m_extensionNamespaceURIs.end()
     ---
     > || ExtensionNamespaceURISetType::const_iterator(m_extensionNamespaceURIs.find(theURI)) 
     >    != m_extensionNamespaceURIs.end()
  • Compile XALAN

        cd xml-xalan/c/src
        sh runConfigure -p solaris -c cc -x CC -z "-D__GNUC__"
        make

    NOTE: I found that only the above parameters to configure work. Don't worry that __GNUC__ is defined. It works with sun C++ 5.1. When using sun C++ 5.1 you don't need the STLPort template library.

  • Make the libraries available

        export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/xerces-c-src1_5_1/lib:/path/to/xml-xalan/c/lib 
  • Now you can run Embperl's Makefile.PL as described above

1 POD Error

The following errors were encountered while parsing the POD:

Around line 395:

=over without closing =back