I have a program I'm writing that makes use of a distributed system. I can't really go into too much detail, but I'm working through some of the issues of remote procedure calling. We're using SOAP (and the SOAP::Lite modules) to handle passing the RPC functions. My dilemma is this, though:

Say I have a module Foo::Machine. Foo::Machine's job, among other things, is to make a call to a SNMP daemon to get information about the host. The SNMP has been abstracted out into another module, Foo::SNMP, so Foo::Machine only needs to pass MIBs, table names, and maybe an option or two (depending on the configuration of the table). Most of the time, Foo::SNMP just makes the call directly, but sometimes, we want Foo::SNMP to make the call via another machine (we're trying to distribute the work). We therefore setup an RPC object (it's a generic object, but in our case, it's using SOAP) that takes the namespace, method, and args and passes them to the other machine. All this should happen behind the scenes, so that Foo::Machine has no clue what's going on.

(inhale)

What is the best way to write a module like Foo::SNMP? Currently, the RPC object is being setup outside of the modules, by program managing all this. My idea is to have the program take the RPC object and "register" it with Foo::SNMP, so that Foo::SNMP can see if it has a registered RPC object and if so, use that rather than making the calls directly. If not, it just uses it's own internal SNMP processing. Is there a better way to do this?


In reply to Remote Calls by Hrunting

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.