|Welcome to the Monastery|
Writing a Perl module that dynamically loads other modulesby mgad (Novice)
|on Mar 01, 2013 at 19:43 UTC||Need Help??|
mgad has asked for the
wisdom of the Perl Monks concerning the following question:
I've been looking through CPAN trying to find some examples of a Perl module that does this, but I haven't come across one that seems like a fit for my specific application. Basically, I'm writing a module that will read a file, slurp in it's contents, parse through the contents until it finds a FILETYPE, load a module based on the FILETYPE, and then continue processing the rest of the file. The end goal is to return a data structure ($self) that contains the important parts of the file (important parts are identified by regexs).
The files I'm reading look something like this:
The module I've created thus far looks like this:
The individual modules to be loaded would be lists of if/then regexs that would identify info and save it to the data structure like so:
Any suggestions of places to look or other modules that do something similar? I've been looking over the source code of tons of other modules (a useful exercise anyway) but I figured having some external input from experts wouldn't hurt.
Cheers and thanks!