Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: perl : Passing hash , array through socket program betwen client and server

by NetWallah (Canon)
on May 13, 2010 at 05:24 UTC ( [id://839774]=note: print w/replies, xml ) Need Help??


in reply to perl : Passing hash , array through socket program betwen client and server

You can wrap the socket send/receive around appropriate parts of the following functional snippet:
#$perl -w use Data::Dumper ; use warnings ; use strict ; my %hash = ( "file" =>"log.txt" , size => "1000kb") ; $Data::Dumper::Deepcopy =1; my $send_string = Dumper \%hash; # Pretend that $send_string has been sent across the socket, then recv +d. # Since $sendstring starts with $VAR1={...}, for "strict", we need # to pre-pend the "my", such that it reads "my $VAR1={...}" my $rcv_string = "my " . $send_string; my %hash_rehydrated = %{ +eval $rcv_string }; # Assuming trust here... print Dumper \%hash_rehydrated;

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

  • Comment on Re: perl : Passing hash , array through socket program betwen client and server
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found