Chapter 4
modules (as opposed to prerequisite modules that are required for your module to 
work) to provide advanced functionality. It wouldn't be appropriate to place such 
modules in PREREQ_PM since that will cause them to be installed by people who 
don't intend to use the advanced features. However, you might not want to be 
totally silent about the choice either.
An example of this situation can be found in the Net::FTPServer
17
 module. If 
the user installs the Archive::Zip
18
 module, then Net::FTPServer will enable FTP 
clients to request zipped versions of files. To alert users during installation to this 
option, Net::FTPServer includes code inside Makefile.PL that checks for Archive::Zip 
and prints a message if it's not found:
Checking for optional module Archive::Zip >= 0.11 ... not found.
*** Archive::Zip is missing. This module is required if you want to
enable archive mode, which allows users to create ZIP files on
the fly from directories on the server.
The code in Net::FTPServer's Makefile.PL then calls sleep(1) to give the user the 
chance to read this message before the usual flurry of make output continues. Some 
modules handle this situation by prompting the user, asking whether to continue 
without the optional module or abort the installation process. This ensures that 
users will read the message, but at the cost of breaking unattended installation. If 
you've ever had the experience of firing up a lengthy CPAN.pm installation, getting a 
cup of coffee, and coming back to find that the first module stopped the installation to 
ask a question, then you'll probably avoid this path!
Adding custom code in Makefile.PL works fine for checking module depen 
dencies, but if you need to modify the generated Makefile, then you'll need to 
extend ExtUtils::MakeMaker itself. ExtUtils::MakeMaker provides a simple way to 
do this: Just define subroutines in the MY package, and they'll be called automati 
cally instead of the normal ExtUtils::MakeMaker methods.
19
I ran into a situation like this while developing the Guile
20
 module. As you may 
have noticed earlier, the default make test implementation sets the PERL_DL_NONLAZY
environment variable when it runs the test scripts. For reasons best left unex 
plored, this setting makes testing the Guile module impossible; the underlying 
17. Available on CPAN, this module implements an FTP server (almost) entirely in Perl. It was 
written by Richard Jones, Rob Brown, Keith Turner, Azazel, and many others.
18. Written by Ned Konz and available on CPAN
19. This works because the MY package inherits from the MM package that ExtUtils::MakeMaker 
uses to abstract platform dependencies. See the ExtUtils::MakeMaker documentation for the 
details.
20. This module provides a Perl binding to the GNU Guile Scheme interpreter. It is available on 
CPAN.
120






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting perl

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved