Daniel B. Hemmerich wrote:
> What is a better route to go?
> 
>  
> 
>    1. Have a handler in Apache call a package directly using a handler()
>       – having the module itself parse out arguments passed in and
>       loading configuration files based on argument values.
>    2. Build a script in /cgi-bin/ that uses mod_perl2, parses passed in
>       arguments, loads configuration files, and then creates a new
>       instance of the module mentioned in option 1, and then calls a
>       “run()” in the module that performs all the real work.

Either way works fine. Using a script uses a little more overhead since it uses
Apache::Registry (or Apache::PerlRun), but if your script is small then the
difference is almost non-existent. You should pick the approach based on
structure since speed/efficiency is not really an issue.

> Is using new() under mod_perl2 inefficient at all that it would be best
> to not use it when not necessary?

new() in Perl is just a method. It's no more or less efficient than any other
method. In general, using OO programming is less efficient than straight
procedural as far as speed and memory go. People write OO code not for it's
efficiency, but for the organizational benefits for the developers.

I know run() and new() are pretty generic names, but out of curiosity, are you
using CGI::Application?

-- 
Michael Peters
Developer
Plus Three, LP

Reply via email to