On Wednesday 25 May 2005 1:19 pm, Luinrandir Insight wrote:
> As I understand Pack/Mod are loaded into memory when the main program is
> run.
> So saving memory is not the issue here... using Packs or Mods is mainly for
> programming ease.
> Yes or No?

Yes, modules are primarilly about making your code easier to work on.  
However, you do want to preload your code during the server startup, which 
saves memory.
http://modperlbook.com/html/ch10_01.html

> So the way I was going to design the program is
>
> Main program processes the <INPUT> from something like:
> main.cgi?location=castle&coins=12&horses=2.. etc.
>
> once the input is split....it goes to a big if-elsif-elsif-elsif-elsif-....

Check out the CGI::Application module on CPAN.  There are also some articles 
that have been written about it that explain the basics of separating the 
parts of your program into a model-view-controller design.

> So all I am really doing is moving the subroutines to packages....

Packages are just collections of subroutines and data under a specific 
namespace.  If you can't imagine why this is beneficial, you might want to 
read a book about programming best practices, like Code Complete.

- Perrin

Reply via email to