You said ---> Lately I have been trying to factor out
common code and make things more modular. So I now use
only one subroutine to generate pages. I just pass
this sub the appropriate parameters (template, values,
etc.) I find that it's easier to expand/update the
program this way. ---
This is what I am looking for, but I dont quite
understand how it is done. Do you have an example?
And, yes, my host is running mod_perl. I know a bit
about how it "caches" a script. I'm still learning
how it is done though...
--- Andrew Brosnan <andrew@...> wrote:
> On 11/11/02 at 6:42 AM, self_deprecated@...
> (Will) wrote:
> Hello Will
> > I have a code design idea, but I am not sure if it
> > all that efficient, so I wanted to ask if there is
> > better way to do what I am thinking.
> > Suppose I have a script, like a bulletin board,
> > I know will produce five webpages:
> > 2.) read_posts, 3) reply_2_post, 4.) confirm_post
> > 5.) error_mssg. Currently, I look at it like I
> > at least five subtroutines - one for each page -
> > any other subroutines that may be necessary.
> I used to do things this way. Lately I have been
> trying to factor out
> common code and make things more modular. So I now
> use only one
> subroutine to generate pages. I just pass this sub
> the appropriate
> parameters (template, values, etc.)
> I find that it's easier to expand/update the program
> this way.
> > Basically, I just use perl to initialize the
> > variables, and then insert those values into the
> > via the template tags.
> > The concern I am trying to lead up to here is that
> > headers and footers in each "page"/subroutine are
> > same from page to page. If I understand
> > all this stuff gets compiled at runtime The
> > would probably be more efficient if I were able to
> > somehow "factor out" those common areas into the
> > logic (main logic = driver) of the script, but I
> > not sure how to do that. Can anyone explain a way
> > handle this?
> Does the above help?
> If the script is not calling a sub (ie not
> outputting a particular page)
> I wouldn't be too concerned. Perl will compile it
> very fast. Then at
> runtime, it's just not being used; which is where
> any slowdown would
> probably occur.
> Try testing it with the benchmark module. Sometimes
> I agonize over
> efficiency problems that don't actually exist :-)
> If efficiency is a *big* concern, have you
> considered mod_perl?
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos