2008年8月1日星期五

How can I use modules from CPAN

How can I use modules from CPAN?

As of version 5.005, ActivePerl supports the MakeMaker utility. This allows you to install modules from CPAN, but requires you to have a make utility, such as nmake or dmake. Modules are generally distributed in gzipped tar files, such as Data-Dumper-2.08.tar.gz.

However, ActivePerl includes the Perl Package Manager (PPM), a utility that allows you to install modules, including modules that contain binary extensions. You should consider using PPM to install a module, as this greatly simplifies the management of modules.

Nevertheless, there are times when it is necessary to build a module from source. Typically, an installation session goes something like this:

  1. Extract the module. This creates a directory based on the name of the archive.

        gzip -d -c Data-Dumper-2.08.tar.gz | tar xvf -
  2. Change directory to the module's directory.

        cd Data-Dumper-2.08
  3. Consult the README file.

        more < README
  4. Run the Makefile.PL script. This uses the MakeMaker module to build a makefile you can build the extension with.

        perl Makefile.PL
  5. Run your make utility. This prepares the module for installation, and compiles any extension if one is present.

        nmake
  6. If this module has tests, run them.

        nmake test
  7. If the tests succeeded, install the module.

        nmake install

See Where can I find Win32 ports of UNIX tools? for information on the availability of tools like gzip and tar.

http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/Windows/ActivePerl-Winfaq9.html#How_can_I_use_modules_from_CPAN_

没有评论: