12.11. Custom Import RoutinesLet's use CGI.pm as an example of a custom import routine. Not satisfied with the incredible flexibility of the Exporter's import routine, author Lincoln Stein created a special import for the CGI module.[75] If you've ever gawked at the dizzying array of options that can appear after use CGI, it's all a simple matter of programming.
As part of the extension provided by this custom import, you can use the CGI module as an object-oriented module:
or a function-oriented module:
If you don't want to spell out every possible subfunction, bring them all in:
And then there's pragmata available. For example, if you want to disable the normal sticky field handling, simply add -nosticky into the import list: use CGI qw(-nosticky :all); If you want to create the start_table and end_table routines, in addition to the others, it's simply: use CGI qw(-nosticky :all *table); Truly a dizzying array of options.
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|