> I think what you are suggesting is using a communications protocol of
> some sort, which was a little more than I was thinking, but a very
> good idea none the less... (gotta remember to think outside the box)

Whoops.. accidentally fell into personal shorthand when talking to someone outside my own head. I didn't mean 'protocol' in the sense of adhering to TCP/IP, COM, or some other established standard. What I meant was something along the lines of 'implementation independent interface specification'.

See, when I think 'interface spec', I think about function signatures:

set_value (hash_key: string, key_value: string) : nil get_value (hash_key: string) : string
and while that's a necessary step on the road to shippable code, it's a truly rotten place to start. There's too much detail, and it's far too easy to get so bogged down in the minutae of 'how it works' that you lose sight of the big question: 'what does it do?'

So.. I was really just suggesting you decide how to partition the system, then figure out what the pieces need to say to each other.


> I guess the quick answer (and hopefuly simplest)I was looking for was
> what are my options if I want to be able dynamically load modules
> into a perl program and then subsequently call them through out the
> program. From the research I've seen it might be possible to open the
> config file, parse through and loop through with an "eval" statement
> at every module...

I think I see where you're going. Yes, you can eval() code into a program:

$code = <<DONE; sub func { print "hello, world.\n"; } DONE eval $code; &func;

and you can get that code from an external file:

$file = '/some/file/path'; open (CODE, $file) or die qq(can't read "$file": $!); $tmp = $/ ; undef $/; $code = <CODE>; $/ = $tmp; close CODE; eval $code; ## and then run some function defined in that code.

mike
.


In reply to Re: Re: Re: Best/possible ways to dynamically use modules by mstone
in thread Best/possible ways to dynamically use modules by pdt1630

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.