Robert wrote:
"Michael Peters" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Robert wrote:
I am currently building out a reporting system that uses C-A and H-T to
query some backend databases and then creating reports out of that data.
Currently I use three files to do this. I use my initial starter
(index.pl)
which calls my app.pm script with all the runmodes and the tmpl files
for
all my templates. I am currently putting all my calls in the .pm file.
Is
there a point where you would split out the .pm file in multiple ones?
Or
does the size of the actual .pm script mean little or nothing in
performance
or other considerations?
Yes and yes. Size is important for performance if you are running under
normal CGI (and not mod_perl) since your module will need to be compiled
upon each and every request. This means that if it is bloated even
simple requests will need to load the whole thing. Under mod_perl this
isn't an issue since modules are loaded once and then cached.
Another important issue to face is maintenance. If you split you run
modes into different modules based on their functionality (or on the
data they deal with) it will make the job of finding bugs, adding new
features, etc easier. For instance, all of you code that manages users
(adding new ones, changing passwords, preferences, etc) should be in one
module and code that manages a shopping cart should be in another
(assuming your app has a shopping cart and users).
HTH,
I am running it under CGI. So far it is just data queries. A question I have
then is how to I call the other modules? Do I just chain them?
Take a step back and look at you app. Split the functionality into
functionality that logically go together. Each split piece can have it's
own .pm module (based on C::A) and it's own .cgi instance script. For
instance, Users.pm and users.cgi. To make it even better, create a base
class for your application (maybe Base.pm) based on C::A that would have
all of you session handling, config file reading, etc. Then each
application module could have it as it's base instead of C::A. This way
all of you user stuff is in one place, all of your session/config stuff
in another, etc.
Does that make sense?
Michael Peters
Developer
Plus Three
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]