in reply to Can perl modules be compiled?

I'm curious just *how big* is your module? I've never experienced anything close to a 10s startup time on a reasonable machine.

Also, if 2s is still too slow for you, you could take the modperl route of keeping a long-running server going to service requests, so there's only a one-time startup penalty.

Replies are listed 'Best First'.
Re^2: Can perl modules be compiled?
by mad_ady (Acolyte) on Feb 27, 2007 at 06:52 UTC
    My main module is about 50k in size and uses Net::Telnet::Cisco, Error.pm, Log4Perl, DBI and a lot of regular expressions.

    When I tried to compile my script that uses this module, I tried to generate a standalone perl script, and this script was 2M in size! :)

    I guess that would account for the slow startup time.

    I'm not sure about modperl, because my script doesn't run from inside a web browser, but my script is called frequently (about once every 5-10 seconds), so I'd appreciate it if I could compile it once and run it many times without recompilation. Can it be done from outside the browser?
      mod_perl does what you want by loading your code into an anonymous coderef and calling it when needed. You could do the same by simply turning the script into an infinite loop with a sleep or possibly some kind of polling, if external input is required