in reply to require() on the fly

You might look into other CGI-type modules like CGI::Lite or some other lib that you find under this search. For your second question, don't forget to import modules after requiring them. Since you're doing this runtime linking stuff, be sure to use CGI::Carp in combination with fatalsToBrowser.
AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.

Replies are listed 'Best First'.
Re: Re: require() on the fly
by BooK (Curate) on Jan 16, 2001 at 05:10 UTC

    In fact since This.pm (and That.pm) will only hold subroutine definitions, it won't be a package (no package This; at the beginning)... So I don't think I'll even need to use import or @EXPORT...

    It's really meant to be a convenient (and efficient) way to parse only the necessary subroutine code in order to speed up the script a bit. My question was more like: "Is it really worth it?"

      require reads and does preliminary parsing on the file. Saving one on a larger file will certainly save you time though probably not much if you're just loading a few functions. If you want to work on encapsualtion and efficiency, a package setup would work well. "Is it really worth it?" Probably not. But definitely give CGI::Lite a whorl.
      AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.