in reply to Modules that do Less

This is a common criticism of CGI.pm, but it's one that's totally unfair. CGI.pm makes it very simple to load just the bits of it that you need. There are a large number of export tag sets defined, it's just a case of choosing the one(s) that you need.

Like you, I find myself using the Template Toolkit for many of my CGI scripts and only use CGI.pm for the actual CGI protocol. I therefore find most of my CGI scripts starting out something like this:

use CGI qw(param header); use Template;

As an aside, Lincoln Stein has been promising to split CGI.pm into separate modules for some time, but I'm not sure how far he's got with the project.

--
<http://www.dave.org.uk>

Perl Training in the UK <http://www.iterative-software.com>

Replies are listed 'Best First'.
Re: Re: Modules that do Less
by AidanLee (Chaplain) on Jun 12, 2001 at 18:01 UTC

    A very good point, and perhaps this speaks to an area of weakness in my Perl knowledge. Extrapolating to a more general scenario:

    There's a module that I'd like to use. It does everything under the sun for a particular area of expertise. I want to use three of its functions, and export only those. Do I or do I not get a penalty in terms of memory/compile speed for having to load the rest of the module into memory at compile time? Even if only those three functions are imported into my name space?

      If the module uses AutoLoading or SelfLoading or something similar, than the cost is nearly zero. If the module doesn't, then you might want to patch it so that it does and submit the patch to the author. Large modules should do this for the reasons you give.

              - tye (but my friends call me "Tye")