http://www.perlmonks.org?node_id=271566


in reply to Best way to 'add modules' to web app?

Sounded like a "make it flexible" requirement.

The other monks already offered valid advices to heed on.

Suppose you want or need to go ahead. It depending on whether your "modules" are more configuration-like or API-like, there're pretty of real life examples how other people did it.

In either case, XML is increasingly commonly used as a meta-language, instead of self-invented pseudo (markup) language, say, used in some configuration files by some programs.

In Why I like functional programming posted a long while back, it showed you how to use hashes (and functional programming, of course) to set up a series of tag and handler pairs to more conveniently manage the processing of any special tags, HTML or otherwise.

In a "module" framework, the hashes above could be replaced by XML. The definition of a corresponding handler could be some RegEx or Javascript allowed and appropriate.

Microsoft WSC (Windows Script Component) is a nice example, where you can use XML and scripting language to build COMs (which otherwise is not always necessarily an easy task).

Apache itself is another more complicated example, where you could build a module without having to compile the whole thing all over again, considering especially "component model" is not naively part of Unix or Linux by default.
  • Comment on Re: Best way to 'add modules' to web app?