Remote-Perl

 view release on metacpan or  search on metacpan

lib/Remote/Perl/Client.pm  view on Meta::CPAN

# NOTE: this file runs on the remote side and must stay compatible with Perl 5.10+.
package Remote::Perl::Client;

# Remote bootstrap client.  Sent verbatim by Bootstrap.pm and eval'd on the
# remote side.  Only uses Perl core modules.
#
# Architecture: one persistent relay process, plus one executor per RUN.
#   Client (relay)  -- owns the protocol pipe; runs the select loop permanently.
#   Executor        -- runs the user script with real STDIN/STDOUT/STDERR pipes.
#
# This split means the protocol loop is never blocked by script I/O, enabling
# real-time stdout/stderr streaming and correct signal forwarding.

use Fcntl  qw(F_SETFD FD_CLOEXEC O_RDWR);
use Socket qw(AF_UNIX SOCK_STREAM);
use POSIX  qw(WNOHANG);

# -- Save real pipe handles before any redirection -----------------------------
open(my $PIN,  '<&', \*STDIN)  or die "dup STDIN: $!\n";
open(my $POUT, '>&', \*STDOUT) or die "dup STDOUT: $!\n";
binmode($PIN); binmode($POUT);



( run in 0.522 second using v1.01-cache-2.11-cpan-5511b514fd6 )