I developed my own module (package) for example MyUtils.pm.
That is a file located on same folder than the main.cgi that use it. Then I use the module with use MyModule;
I think that is a bit slow. Or suppose there's a better way. Is it possible to "compile the module" and include it in perl core or something like that?
If yes, I think it will load and run "faster".
Don't worry too much about it. The overhead of loading a Perl module is quite low.
If your application is getting enough traffic that this overhead does become significant, it's time to stop using CGI — the overhead of starting the Perl interpreter becomes a problem on its own. Consider switching your site to use something like FastCGI (with CGI::Fast or Plack::Handler::FCGI), or the mod_perl Apache module (possibly in conjunction with ModPerl::Registry to run CGI scripts directly, or with Plack::Handler::Apache2). Any of these will allow multiple consecutive requests to be handled by a single process, bypassing the module loading process entirely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With