Hrunting has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|