CPAN Module Distributions
An alternate method of packaging multiple modules within a distribution is to 
create a lib directory inside your distribution. Inside lib you then create the full 
module path for each included module. If this were done with HTML::Template::JIT, 
then the path to JIT.pm inside the module distribution would be 
lib/HTML/Template/JIT.pm. Note that you would have to modify 
Makefile.PL's VERSION_FROM and ABSTRACT_FROM to point to the new location of 
JIT.pm. Using lib provides a more flexible system since it allows a distribution to 
contain modules with different root names collected under a common tree.
Executable Scripts
Module distributions can contain more than just modules, they can also contain 
executable scripts. For example, the LWP
16
 module distribution contains a script 
called lwp download that uses the LWP modules to download files from the Web. 
When you install the LWP distributions on your system, this script and others are 
installed alongside Perl's executable scripts, usually somewhere in your PATH.
Including scripts with your modules can serve two useful purposes. First, they 
allow nonprogrammers to access the functionality of your module. Second, they 
can provide examples for programmers of how to use your module to accomplish 
a simple task.
By default ExtUtils::MakeMaker installs any file ending in .pl other than 
test.pl in the top level module directory as an executable script. See the 
ExtUtils::MakeMaker documentation for details and a description of the PM option 
to WriteMakeFile() that can be used to search for .pl files (and .pm files) in other 
locations.
Self Modifying Code
If you look at the LWP distribution, you'll see that the scripts aren't distributed as 
.pl but as .PL files. The reason for this is that they need to be processed before they 
can be installed on the user's machine. To see why this is necessary, consider the 
script file in Listing 4 10, count_args.pl, that counts its arguments. If this file were 
distributed as is with Data::Counter, it wouldn't work on many users' systems. 
This is because the first line contains the path to the perl executable. Since this 
path varies from system to system, count_args.pl would only work on other 
systems where perl is installed in /usr/bin.
16. LWP provides client and server modules for all manner of network communication. LWP was 
written by Martijn Koster and Gisle Aas and is available on CPAN.
11
117
7






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