If efficiency is not much of an issue for you, using SOAP is a possibility: gSOAP on the C side and some SOAP module from CPAN on the Perl side (for instance, SOAP::Lite).
Anyway, for a good C programmer, learning XS is not so hard, after a couple of weeks, you will feel confortable using it.
| [reply] |
| [reply] |
| [reply] |
I feel like I said this a bunch of times here recently, but you should take a look at POE. Once you get the hang of it, you can create some very nice network servers without a lot of code.
| [reply] |
My advice is to stay away from SOAP. Yes the perlembed interface can be a bit of a PITA.
Check out how simple it is to write TCP clients and servers using IO::All. I've just implemented an "RPC" mechanism of sorts with it and think it's great. The one-line HTTP server that supports CGI is hilarious.
If it seems appropriate for your task, I'd have to recommend the Syck library from WhyTheLuckyStiff, which will allow you to convert your structures to a format called YAML. The primary advantage of doing this over XML, for instance, is that the messages are easier to debug, most of the parts are already there, and you're sending data structures using a format designed for data structures and NOT a standard for documentation markup.
$h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/."
."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";
| [reply] [d/l] |
Two comments:
- Somebody other than me probably read that comment and immediately wanted to see the Tiny Web Server, so there's a link. And here's the actual code (notice 11-sh unnecessary spaces, so it's actually designed to be readable):
perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1
+? "./$1 |" : $1) if /^GET \/(.*) / })'
- The Perl Advent Calendar has another discussion of YAML (using a different library --- perhaps slower than Syck, however?).
| [reply] [d/l] |