I was just wondering what is best for performance when making a web service in Perl.
Is it best to have as short as possible .pl script and put as much code as possible in a module that is used by the .pl script, or doesn’t it impact performance if i don’t use a module at all?
I am using mod_perl on a CentOS Linux box with perl 5.8.8.
Since you’re using
mod_perl, there is no appreciable performance penalty in spreading your code across as many files as you like. Using modules, small, testable functions, and an object-oriented structure for your code will make it much more maintainable, reusable, and extensible. And you don’t need a.plscript at all, since you’re usingmod_perl. Just do something like:httpd.confMy/WebApp.pmUsing a web application framework makes it even easier. CGI::Application has excellent mod_perl support built in.