Re: Should I use Package or Modual or what?

[prev] [thread] [next] [Date index for 2005/05/25]

From: Perrin Harkins
Subject: Re: Should I use Package or Modual or what?
Date: 17:16 on 25 May 2005
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

(message missing)

Apache2::Reload problems
Mark 06:42 on 25 May 2005

Re: Apache2::Reload problems
Stephane GUIBOUD-RIBAUD 06:48 on 25 May 2005

Re: Apache2::Reload problems
Mark 15:53 on 25 May 2005

Re: Apache2::Reload problems
Stas Bekman 17:37 on 25 May 2005

Should I use Package or Modual or what?
Luinrandir Insight 17:19 on 25 May 2005

Re: Should I use Package or Modual or what?
Perrin Harkins 17:16 on 25 May 2005

Re: Should I use Package or Modual or what?
Perrin Harkins 17:57 on 25 May 2005

a mystery.. need help
Luinrandir Insight 08:36 on 29 May 2005

[OT] Re: a mystery.. need help
Frank Maas 10:37 on 29 May 2005

Re: Apache2::Reload problems
Philippe M. Chiasson 09:24 on 25 May 2005

Re: Apache2::Reload problems
Mark 15:30 on 25 May 2005

Re: a mystery.. need help
David Dick 05:37 on 29 May 2005

Re: a mystery.. need help
Luinrandir Insight 02:10 on 30 May 2005

Re: a mystery.. need help
Tom Schindl 07:55 on 30 May 2005

Re: a mystery.. need help
jonathan vanasco 16:23 on 30 May 2005

Re: a mystery.. need help
Luinrandir Insight 20:15 on 30 May 2005

[MP2] How to turn off caching?
Foo Ji-Haw 04:23 on 31 May 2005

Re: [MP2] How to turn off caching?
Rodger Castle 05:11 on 31 May 2005

Re: [MP2] How to turn off caching?
Foo Ji-Haw 07:45 on 31 May 2005

Re: [MP2] How to turn off caching?
Torsten Foertsch 09:31 on 31 May 2005

Re: [MP2] How to turn off caching?
Issac Goldstand 08:50 on 31 May 2005

Generated at 20:12 on 05 Jun 2005 by mariachi v0.52