ADBRITE ads links
You are here: CodeIdol.com > Perl > Intermediate Perl > Using Modules
Intermediate Perl
| 3.1. The Standard Distribution
Perl comes with many of the popular modules already. Indeed, most of the 50+ MB of the most recent distribution are from modules. In October 1996, Perl 5.003_07 had 98 modules. Today, at the beginning of 200...
|
|
| 3.2. Using Modules
Almost every Perl module comes with documentation, and even though we might not know how all of the behind-the-scenes magic works, we really don't have to worry about that stuff if we know how to use the interface. That's why th...
|
|
| 3.3. Functional Interfaces
To load a module, we use the Perl built-in use. We're not going to go into all of the details here, but we'll get to those in Chapters 10 and 15. At the moment, we just want to use the module. Let's start wit...
|
|
| 3.4. Selecting What to Import
Fortunately, we can tell the use operation to limit its actions by specifying a list of subroutine names following the module name, called the import list:
use File::Basename ('fileparse', '...
|
|
| 3.5. Object-Oriented Interfaces
Contrast the subroutines imported by File::Basename with what another core module has by looking at File::Spec. The File::Spec module is designed to support operations commonly performed on file sp...
|
|
| 3.6. A More Typical Object-Oriented Module: Math::BigInt
So as not to get dismayed about how "un-OO" the File::Spec module seems since it doesn't have objects, let's look at yet another core module, Math::BigInt, which can handle in...
|
|
| 3.7. The Comprehensive Perl Archive Network
CPAN is the result of many volunteers working together, many of whom were originally operating their own little (or big) Perl FTP sites back before that Web thing came along. They coordinated their effor...
|
|
| 3.8. Installing Modules from CPAN
Installing a simple module from CPAN can be straightforward: we download the module distribution archive, unpack it, and change into its directory. We use wget here, but it doesn't matter which tool you use....
|
|
| 3.9. Setting the Path at the Right Time
Perl finds modules by looking through the directories in the special Perl array, @INC. The use statement executes at compile time, so it looks at the module search path, @INC, at compile time. Th...
|
|
| 3.10. Exercises
You can find the answers to these exercises in "Answers for Chapter 3" in the Appendix.
3.10.1. Exercise 1 [25 min]
Read the list of files in the current directory and convert the names to their full path spec...
|
|
You are here: CodeIdol.com > Perl > Intermediate Perl > Using Modules
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|