rrwo has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on some code using HTML::Template, and I've decided it makes more sense (in theory) to use CGI::Minimal rather than CGI, since I'm not really generating HTML code.

But I'm using cookies. And CGI::Cookie appears to make use of the CGI module. So performance-wise, I'm still loading the CGI module (even if I'm only using a few subroutines) when I use CGI::Cookie.

So is it even worthwhile to use CGI::Minimal in this case? I may as well just use CGI.

Or am I missing something about how Perl loads modules? I don't see it as much of a performance gain to parse an entire module for a few subroutines than to load the module.

  • Comment on Is it worth using CGI::Cookie with CGI::Minimal?

Replies are listed 'Best First'.
Re: Is it worth using CGI::Cookie with CGI::Minimal?
by mattr (Curate) on Mar 01, 2002 at 10:49 UTC
    Recently there was a discussion about this concerning a new module proposal. But it is fine to go ahead and use CGI.pm since the module is very efficient and only loads the functionality that is required by the code.
Re: Is it worth using CGI::Cookie with CGI::Minimal?
by shotgunefx (Parson) on Mar 01, 2002 at 08:16 UTC
    I see that it uses CGI::Utils, but I don't see anywhere in the source that CGI::Cookie uses CGI.pm

    I see this as well.
    Although CGI::Cookie is intended to be used in conjunction with CGI.pm (and is in fact used by it internally), you can use this module independently.

    -Lee

    "To be civilized is to deny one's nature."