[Chicago-talk] Sockets & Hashes

Jonathan Rockway jon at jrock.us
Sun Mar 25 20:53:43 PDT 2007

On Sunday 25 March 2007 18:22, Jason Rexilius wrote:
> You could serialize it and then send it over a raw TCP socket, yes.
> Or you could use a higher level protocol like XML-RPC or HTTP.. HTTP
> Mechanize on one side and CGI on the other is probably the most mature
> as far as built-in error handling and stuff, most code for cop-paste
> re-use etc..

That alone doesn't do anything, you need to convert the hash to something that 
the other side can convert back to a hash.  Most people use JSON, YAML, or 
XML for this.

Also, you want LWP::UserAgent, not Mechanize in this case (although Mech is a 
subclass of LWP::UA...).  You don't need to "browse" the remote site if 
you're just an API client.  For example, just send an HTTP::Request 
containing your request in JSON and read the HTTP::Response containing the 
answer, encoded in JSON.  See:

package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20070325/7a04a07e/attachment.bin 

More information about the Chicago-talk mailing list