dakedesu has asked for the wisdom of the Perl Monks concerning the following question:
Well, yes, this is a question for a project that will make use of CGI.pm, but that is only done as a constraint. (There are probably a good few of you cringing at me mentioning CGI.pm in the first paragraph)
The reason CGI.pm is relavent is I need this script to appear multiple times in memory, as in, everytime this program is called as a CGI application.
Part two of the problem, is I plan to allow for myself, and "end-users" (yes, all three of them), be able to add to the application, by making modules to handle different forms of content.
plain content would look like this:
type: sbtext title: Some random text file desc: In this file there will be random stuff. [data] This is the random data.
That content would be loadined with a Widgets::sbtext.pm module in an application making use of the datat in the file. You'll notice that sbtext.pm corrisponds to the "type" field in the plain text wrapper file. No, I do not plan to have plans for building any wrapper files for binary data. I am crazy, but not that crazy.
However, there may be other "types" that have fields other than title and desc. Some may contain image urls, as part of a gallery. Some might contain download locations, some might be meant for the serverside to script. Some might extend a type to allow for "next/prev" buttons
Okay, so now you know some of the background
In previous attempts to code this, I have tried to "eval" a "use" statement to load the module. The only problem is, the appropiate module isn't getting loaded. On top of that, making an instance (?right word?) of the module don't happen dynamically. Now, if I hardcode the application to use a certain module it works fine. However, hardcoding it (a) makes the application take up larger ammounts of memory each time loaded, and make it harder for my end users (all three of them) to develop. (Where by their development should be as simple as making an child module to say, Widgets::base.pm and drop it into the appropiate directory, and add the sbdat text wrappers to there filebase)
Demo code of this not working available on request.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module Swap Question
by Taulmarill (Deacon) on Aug 23, 2005 at 14:30 UTC | |
by dakedesu (Scribe) on Aug 23, 2005 at 19:22 UTC |