I am using RPC.pm, from Advanced Perl Programming, to query an NT database from a linux box. Very cool module!
I have a script that runs on the NT box (server.pl) and another that runs on Linux (client.pl). RPC.pm allows me to call server.pl methods from client.pl, similar to the following.
In server.pl:
sub is_ID_valid {
my $ID = shift;
# Query the database, see if the ID is valid.
return $valid;
}
In client.pl:
$valid = $connection->rpc('is_ID_valid', $ID);
This works quite well. The RPC module dispatches the 'is_ID_valid' from the client to the server to which we are connected.
In Chapter 13 of Advanced Perl Programming, Srinivasan states that, "The client code
knows it is making an RPC call. Making this transparent (as typical RPC systems do) is quite simple, really. Using eval, we can dynamically create a dummy client stub ... on the caller's side and have it make the call to rpc(). "
It's that, "quite simple, really," part that has me seeking wisdom.
- How do I use eval to create a dummy stub on the client side?
- In Srinivasan's example rpcdemo.pl, the client and server code are in a single script. Would this be a better way to go?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.