in reply to Running local code on other machines

Looking for a POE based distributed job scheduler may be helpful, as well as reading up on how POE actually works and it's requirements.

  • Comment on Re: Running local code on other machines

Replies are listed 'Best First'.
Re^2: Running local code on other machines
by spx2 (Deacon) on Apr 07, 2010 at 11:18 UTC
    yes, but how do I serialize a sub and send it on the socket ?

      Be aware that unless your sub is very trivial, you have much more to do than just serialising the sub. If that sub make use of any modules, you'll also have to arrange for those modules to be loaded and initialised at the other machine also. And if those modules use any modules...


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        basically the sub should be just based on its own parameters and nothing else.
      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";
      Put it in a module, and use a source control system. (git, hg, svn, cvs, ...)