CC: | bob [...] cakebox.net |
Subject: | RPC::XML idea: Procedures from module with attributes |
(From email)
Hi
I recently needed to write an XML-RPC interface for some stuff at $work,
and after having a look around decided on using RPC::XML. Good stuff,
thanks!
However I don't really like the XPL thing, wrapping perl in XML... What
I ended up doing is have Project::XMLRPC with all the XML-RPC functions
in @EXPORT_OK, then all my .code files look like this:
# -*- mode: cperl -*-
use warnings;
use strict;
use Project::XMLRPC qw(some_method);
sub method {
some_method(@_);
}
This is/was a project on a deadline, so I didn't have time to do
anything clever, but I thought a bit about this and came up with
something I think might be at least a little clever:
Create Attribute::RPC::XML and create a XMLRPC attribute which takes the
XML-RPC method name as argument (falling back to subroutine name, or
maybe $package+$subname s/::/./g or something like that).
Then, to tell the server what methods have been loaded it could put
method information somewhere global:
$Attribute::RPC::XML::registry{$methodname} = $subref;
Then RPC::XML::Server could have an add_methods_from_module method that
tries to load the module and adds all the methods found in $registry.
If there are any cool modules on CPAN that can parse POD for a module
and output the documentation for just one sub it might even be possible
to automagically expose POD documentation like you now do with the
documentation in the XPL.
What do you think about the idea?
I'm afraid I probably won't have time to code this, at least for a
while, but I figure if it's a good idea I can at least get it out of my
head and into the world.
--
Knut Arne Bjørndal aka
Bob Kåre