CHAPTER 3
Module Design and 
Implementation
P
ROGRAMMING IS BOTH
science and art. The last chapter equipped you with the science 
of modular programming in Perl the syntax and behavior of modules. This chapter 
will present the other side the art of designing and implementing modules.
Just by using modular programming you're ahead of the programming pack 
the majority of working programmers spend their days desperately writing one off 
scripts in a dialect of Perl akin to BASIC. That said, there are good modules and 
there are bad modules. This chapter will help you write modules that resemble the 
former more than the latter. I expect you to treat the advice given critically the 
best design technique to use will depend on your aesthetics, and that's the last 
thing I want to dictate!
Ultimately, there's only one inviolate rule of software design: Do it. It's worth it. 
The satisfaction you gain from jumping into the fray with some impulse coding 
won't last when the first wave of bug reports and unexpected changes lands. I'll 
leave it to the management books to break out the charts and graphs; if you give it 
a try you'll soon convince yourself. Every moment of thought and planning you 
put into a project at the outset will be paid back in spades by the end. It's a rare task 
that's really so small that it's worth knocking off without consideration.
Check Your Slack
Before you start a new module, you should visit CPAN.
1
 You may be able to avoid a 
lot of work (and thus gain a lot of slack) by reusing an existing module. If you need 
features that an existing module doesn't provide, consider extending the module. 
Object oriented modules can usually be extended through inheritance. If you 
make changes to a CPAN module, consider contributing those changes back to the 
author.
2
 Remember, one of the virtues of a Perl programmer is laziness; CPAN is 
the greatest enabler of programmer laziness since the terminal!
1. See Chapter 1 for copious instructions.
2. If you'll be distributing your module, then you may be required to release the source for any 
changes under the same license as the module. Be sure to read the license for the module 
before you start making modifications!
65






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