Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: XML-RPC API layout

by jdrago_999 (Hermit)
on Jul 21, 2009 at 17:34 UTC ( [id://782030]=note: print w/replies, xml ) Need Help??


in reply to XML-RPC API layout

Does anybody feel there are any large oversights or omissions?

I might replace the export_procedures sub with something more declarative. Also, it would be nice to *not* have to use base 'XMLMethod';. Something like:

package MyPackage; use strict; use warnings 'all'; # This would import rpc_method into the current namespace: use XMLMethod 'rpc_method'; # Declare a method as rpc-able: rpc_method( 'math.sum', \&API::Math::sum, [qw/ int int int /] ); # Or maybe: rpc_method name => 'math.sum', method => \&API::Math::sum, signature => [qw/ @int /]; rpc_method name => 'math.avg', method => \&API::Math::avg, signature => [qw/ @int /]; rpc_method name => 'string.join', method => \&join, signature => [qw/ @str /];

Replies are listed 'Best First'.
Re^2: XML-RPC API layout
by kalium (Sexton) on Jul 21, 2009 at 18:00 UTC

    Yes I think that *not* having to use XMLMethod as the base and simply calling a subroutine of XMLMethod would make it easier to understand what is happening and more readable in general.

    Originally when I wrote I was envisioning not having to have anything obviously rpc related in the MyPackage bit, other than use base XMLMethod. This, for me, would have been very elegant. Have a package with a set of subroutines, add the use base XMLMethod and whallah, the package is now set up for xml rpc.

    I felt I couldn't do this reliably though, so I conceeded making the export_procedures sub. I guess the export_procedures sub is not as declarative as something like the rpc_method you suggested, and If I'm going to abandon the original idea of how the XMLMethod should work then maybe there is no point in 'kinda sorta' implementing in the manner it is currently.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://782030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found