in reply to Re: use and performance
in thread use and performance

This isn't entirely true, since all those imports can really kill your script's startup time. If startup time's an issue, you should "use" modules only once, and just "require" them everywhere else. Equally good documentation, but less pain.

/s

Replies are listed 'Best First'.
Re: Re: Re: use and performance
by perrin (Chancellor) on Jun 10, 2003 at 15:36 UTC
    I shudder to think how many imports it would take to make a dent in the startup time of a script on a modern computer. Most imports don't do anything at all.
      Class::Struct is an example of something that does a lot of work on import. This bites the prototype perl6 compiler pretty hard.

      /s

        Are you talking about this kind of usage?

        use Class::Struct CLASS_NAME => [ ELEMENT_NAME => ELEMENT_TYPE, ... ];
        You can't skip that call to import, or your struct class would not get created.

        Anyway, if you don't want to import anything you can just call use with an empty list. This is common in mod_perl:

        use CGI ();