Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Running local code on other machines

by rubasov (Friar)
on Apr 07, 2010 at 11:38 UTC ( #833271=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Running local code on other machines
in thread Running local code on other machines

Umm, serializing a sub is not easy in perl as far as I know, but what about storing your sub's source as a string, send it over the socket as plain text, then eval at the other end of the socket?

my $sub_str = q{ sub { my $n = shift; return $n + 1; } }; # send the string through the socket # at the far end of the socket: my $sub_ref = eval $sub_str; print $sub_ref->(2), "\n";


Comment on Re^3: Running local code on other machines
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2015-07-04 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls