ADBRITE ads links
You are here: CodeIdol.com > Perl > Intermediate Perl > Exporter
Intermediate Perl
| 15.1. What use Is Doing
So, just what does use do? How does the import list come into action? Perl interprets the use list as a particular form of BEGIN block wrapped around a require and a method call. For example, the following...
|
|
| 15.2. Importing with Exporter
In Chapter 3, we skipped over that "and now magic happens" part where the import routine (defined by the module author) is supposed to take File::Basename::fileparse and somehow alias it into the caller's pac...
|
|
| 15.3. @EXPORT and @EXPORT_OK
The import provided by Exporter examines the @EXPORT variable in the module's package to determine which variables it exports by default. For example, File::Basename might do something like:
package File...
|
|
| 15.4. %EXPORT_TAGS
We don't have to list every function or variable that we want to import, either. We can create shortcuts, or tags, to group them under a single name. In the import list, we precede the tag name with a colon. For example, the ...
|
|
| 15.5. Exporting in a Primarily OO Module
As seen earlier, the normal means of using an object-oriented module is to call class methods and then methods against instances resulting from constructors of that class. This means that an OO module...
|
|
| 15.6. Custom Import Routines
Let's use CGI.pm as an example of a custom import routine before we show you how to write your own. Not satisfied with the incredible flexibility of the Exporter's import routine, CGI.pm author Lincoln Stein c...
|
|
| 15.7. Exercises
You can find the answers to these exercises in "Answers for Chapter 15" in the Appendix.
15.7.1. Exercise 1 [15 min]
Take the Oogaboogoo library you created in Chapter 10, Exercise 1 and turn it into a module you can bring in w...
|
|
You are here: CodeIdol.com > Perl > Intermediate Perl > Exporter
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|