Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Speaking between Perl and C

by mugwumpjism (Hermit)
on Jun 03, 2005 at 07:02 UTC ( [id://463136]=note: print w/replies, xml ) Need Help??


in reply to Speaking between Perl and C

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";

Replies are listed 'Best First'.
Re^2: Speaking between Perl and C
by kaif (Friar) on Jun 03, 2005 at 23:11 UTC
    Two comments:
    1. 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 \/(.*) / })'
    2. The Perl Advent Calendar has another discussion of YAML (using a different library --- perhaps slower than Syck, however?).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-16 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found