When you install ActivePerl you get a lot of modules. But sooner or later you'll find out you need some more.
ActiveState has compiled and prepared a lot of modules for you in it's PPM repository and there are several more repositories .
Installing a module from the default repository is very simple. You start the ``Command Prompt'' (or MS-DOS Prompt) and type
c:\> PPM install The-Module
Please note that the double colon in a module name is changed to a dash! If you want to install a module from a different repository you use :
c:\> PPM install --location=http://the.repository.com/packages The-Module
If you run PPM without parameters it will start the interactive mode, allowing you to list available modules, search for modules whose name contains this or that, install modules, add repositories ...
You may get more info in the PerlWin32FAQ 11.
Of course the repositories do not contain all the modules available from CPAN or stay in up-to-date at all times with all the modules. So sometimes you need to build and install a module yourself.
Some modules may be installed by hand, but it's always better to comply to
the standard way(tm) ;-)
This means that you will download the module in question from CPAN or wherever, unpack the archive into some temporary directory and start the command prompt. All this should be relatively trivial, the archive may be unpacked by WinZip and many other tools. The only problem you may have in this stage is that some browsers tend to rename it from Something.tag.gz to Something_tar.gz. Just rename the file back and unpack it by WinZip (or whatever you like).
In the command prompt you will go to that directory (cd c:\temp\Module-Name-version) and run this :
c:\temp\Module-Name-version> perl Makefile.PL c:\temp\Module-Name-version> nmake c:\temp\Module-Name-version> nmake test c:\temp\Module-Name-version> nmake install
The first step checks that you have all the necessary files of the module in current directory, that you have installed all the necessary modules and creates a customized Makefile for your computer. (Makefile is a file that describes how to build the module. The dependencies, compilation parameters etc.)
The next step is what actually builds the module. It calls a few Perl scripts, compiler, linker etc. This step creates a directory blib (built library) in the current directory, and copies or generates the files to be copied into your library or documentation directories there.
The third step runs a test script provided by the author of the module. This script should test if the module was compiled correctly, if it is compatible with your version of perl, OS, modules ... It's not strictly necessary, but you should not skip this step.
Up till now NOTHING has happened to your installation of perl. You've built the module, but you did not install it yet. This is the task of the last command. Only when you issue the ``nmake install'' command the downloaded/generated files are copied to your library directories.
If the module in question doesn't contain any C code (OK, XS code) you do not need to have a compiler. All you need is nmake, which may be downloaded for free from ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe. (I do not know what exactly are the license conditions, there is nothing in the selfextracting archive. But I believe it's OK to use it.)
This all works quite fine under Windows NT, but under Windows 95 you
will keep having problems. The reason is that the Makefile created in
the first step uses some features of cmd.exe that
command.com doesn't understand.
cmd.exe or command.com is the MS-DOS prompt or Command prompt.
It is also the program that processes batch files (*.BAT).
For the simpler modules this command may be sufficient to make the Makefile compatible with Windows 9x, but I can't guarante e anything :
c:\temp\Module-Name-version> perl -pi.bak -e "s/ && /\n\t/g" Makefile
So these are the commands you should try if you are running Windows 95 or 98 :
c:\temp\Module-Name-version> perl Makefile.PL c:\temp\Module-Name-version> perl -pi.bak -e "s/ && /\n\t/g" Makefile c:\temp\Module-Name-version> nmake c:\temp\Module-Name-version> nmake test c:\temp\Module-Name-version> nmake installIf you do have a WinNT computer around I would recommend running the installation on that one. And then move the generated files from blib directory to the library directories on the Win9x machine. Assuming you installed perl into c:\perl it will go like this :
.\blib\arch\auto\* ===> c:\perl\site\lib\auto\ .\blib\lib\* ===> c:\perl\site\lib
As soon as you see a file with extension .XS in the archive you WILL need a C compiler. Actually Microsoft Visual C++ 5.0 or newer. Perl itself was compiled with Visual Studio 97 (which contains Visual C++ as one of the components) and currently you have to use the same compiler for modules as was used for perl.exe, AFAIK.
Now, let's look at the problems you may have.
Some modules really use some unixisms and cannot be used on Win32 systems out of the box. If you get something like ``The Unsupported function fork function is unimplemented'' you should go and ask in the Perl-Win32-Users mailing list, maybe someone has already ported/started porting the module.
Some modules do not compile with PERL_OBJECT. You don't need to know what's that, all you need to know is that if you get some crazy error messages during the compilation stage you may try this :
nmake clean
perl Makefile.PL CAPI=TRUE
nmake
nmake test
nmake install
Often this helps.
Other one. If you get a lot of
Note (probably harmless): No library found for '....lib'
warnings during perl Makefile.PL phase and the nmake fails with tons of
error LNK2001: unresolved external symbol __imp__...
you should open c:\perl\lib\Config.pm and search for 'libpth='. This parameter should contain space separated list of paths to the lib files of perl and of your compiler. I have
libpth='e:\soft\ActivePerl\lib\CORE E:\Soft\devstudio\VC98\lib'
there.
If all this fails ... come and ask :-) The best place is the Perl-Win32-Users@Lyris.activestate.com mailing list. You may either subscribe (I recommend doing this anyway) or browse the archives of this and some more lists on the web.
Now, if you succeed to compile some module, either your own or someone else's, you may want to prepare a PPM distribution and either ask someone to host it in his/her repository or start your own. It's not hard :-)
You'll find the necessary info here : http://Jenda.Krynicky.cz/perl/PPM.html and some more at : http://users.erols.com/mpersico/Perl.html
This all doesn't create the HTML documentation of the installed modules. If you want to regenerate all the HTML documentation of all the modules you have installed together with the index call this :
perl -MHtmlHelp -e "HtmlHelp::MakePerlHtml()"
I should warn you though that it takes a few minutes to do it and that you will see lots of warnings during the process. You should just ignore them. If you only want to regenerate the index :
perl -MHtmlHelp -e "HtmlHelp::MakePerlHtmlIndexCaller()"