CGI and Perl

Practical Issues for Using Modules: Downloading and Installation

At this point, you've seen a few of the techniques for Perl programming using modules, references, and objects. Now how do you actually start using them? This process can be a simple
matter of typing

Perl makefile.PL

and then


from the shell prompt, if you're running your Web server on a UNIX machine.

Installing modules can also be a rather difficult process, depending on which module you want to use and whether you're running on a supported architecture for module installation, and the desired module. If you're running on UNIX, then you need write permission to the library directory(s), corresponding to @INC, as well. For some installations, you also must have the requisite tools, such as a C compiler, make, and a linker which creates shared libraries, as mentioned previously.
Although some of the more important WWW modules are written to be architecture independent, you usually must take some configuration steps to use a typical module on any platform but UNIX. Again, the cross-platform issues are under constant consideration among the folks who bring you Perl.

Traps for Perl4 Programmers Migrating to Perl5

The introduction of all the new features and power in Perl5 has yielded some incompatibilities between Perl4 and Perl5. Most well-written Perl4 programs do run under Perl5 and produce the same results as they did under Perl4. A number of specific examples of Perl4 code, however, may not do what you expect them to do when you run them under Perl5. See PERLTRAP for a description of many of these examples.

In general, you need to inspect your older Perl4 programs against the examples in PERLTRAP to be sure that they don't include any of the items that may produce unexpected results. If they fail to compile, you're in good shape, but watch out for traps that do compile. Also, using the -w switch to Perl is always advisable when you're running any script.


If you've completed this chapter, congratulations! You've now been introduced to the latest and greatest version of Perl, and most of its powerful new features. You've also been exposed to some relatively simple examples which utilize these new features.

In general, the most important concepts you should've gleaned from reading this chapter are

  • A general understanding of the new Perl5 features.
  • A good grasp of the various uses for references.
  • An understanding of how the Perl5 module works, and its variations.
  • What a Perl5 object is, and how it is used.
  • How to invoke a module's methods directly, and through the use of blessed references.
  • The difference between require() and use().
  • The differences and similarities between an imported method via the use() statement and an inherited method via the @ISA array.
  • How to subclass a given Perl5 module, and how to override/augment a parent class's methods.

If you're satisfied that you understand these items, then you're now ready to explore the rest of the chapters and examples in this tutorial. Where appropriate, we may point you back to this chapter to refresh your memory as you go along.

Hopefully, you've also taken the time to explore the external Perl5 POD documentation along the way and learn how it works. You'll be glad you did.

by BrainBellupdated