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.

-- Jamie Payne

In reply to Module Swap Question by dakedesu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.