?
Solved

package,module or ???

Posted on 2001-06-14
2
Medium Priority
?
145 Views
Last Modified: 2010-03-05
Hi Experts,

My question is somewhat difficult to explain, but i'll try anyway :)

I'm working on this cgi application in Perl where an administrator can activate and deactivate certain parts of the application.
There's is a lot of different parts that can be activated or deactivated. My problem is i don't quite know how to implement this the most efficient way.

Should i write all the parts as functions in a package that would be required in the top of my cgi script? The problem with this, as I see it, is that my application would include all the code of the different parts even though they are not needed( if they are deactivated ).

Should I put all the parts in a module?
Should I put each part in it's own module?

Is it possible to somehow only include something in your code if it is needed? ie:
if( module1IsActivated) use module 1;

Or maybe i should do this in a completely different way that i haven't thought of :)

Any ideas appreciated!
0
Comment
Question by:psogaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
marecs earned 600 total points
ID: 6190111
Including code only as it is needed sounds efficient enough. The require keyword only loads a module when it is encountered, rather than the use keyword that loads modules at compile time.

So
if (module1IsActivated) {
   require module1;
}

should work, whereas

if (module1IsActivated) {
   use module1;
}

will gain you nothing because the module is loaded at startup anyway.
0
 
LVL 2

Author Comment

by:psogaa
ID: 6190231
Cool, thanks :)
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question