NAME

remperl - run Perl scripts on remote machines over any pipe transport

SYNOPSIS

remperl [options] HOST script.pl [script-args...]
remperl [options] HOST -e CODE [script-args...]
remperl --pipe-cmd [options] COMMAND script.pl [script-args...]

HOST accepts: hostname, user@hostname, ssh://[user@]host[:port].

DESCRIPTION

remperl connects to a remote Perl interpreter through an arbitrary pipe command, bootstraps a self-contained protocol client on the remote end, and executes Perl code there. STDOUT and STDERR from the remote script are relayed in real time; local STDIN is forwarded on demand.

When --serve-modules is enabled, any module not found in the remote's own @INC is fetched transparently from the local machine. The remote machine needs no pre-installed dependencies beyond a bare Perl interpreter.

For the library interface, see Remote::Perl.

OPTIONS

--rsh=EXECUTABLE

SSH-like command to use (default: ssh). Invoked as EXECUTABLE HOST perl.

--pipe-cmd

Treat the first positional argument as a complete pipe command instead of a hostname. The command is interpreted by sh -c, so quoting and environment variable assignments work as expected.

-e CODE

Evaluate CODE on the remote side instead of running a script file.

--stdin-file=FILE

Read remote STDIN from FILE instead of local STDIN.

--stdin-str=STRING

Use STRING verbatim as remote STDIN. Mutually exclusive with --stdin-file.

--window-size=N

Initial flow-control credit per stream in bytes (default: 65536).

--serve-modules

Enable module serving: missing modules are fetched from the local machine's @INC on demand. Disabled by default. Use --no-serve-modules to explicitly disable.

--inc-local=PATH

Prepend PATH to the local @INC used when serving modules. May be specified multiple times.

--version

Print the version and exit.

--help

Print this message and exit.

EXAMPLES

Run a script on a remote host:

remperl hostx myscript.pl

Pass user@hostname directly to ssh:

remperl alice@hostx myscript.pl

Evaluate inline code:

remperl hostx -e 'use Some::Module; print Some::Module->greet'

Pass arguments to the remote script:

remperl hostx myscript.pl arg1 arg2 "arg three"

Pipe stdin to the remote script:

echo "hello" | remperl hostx myscript.pl

Use a custom ssh-like executable:

remperl --rsh=my-ssh hostx myscript.pl

Use an arbitrary pipe command (Docker, kubectl, etc.):

remperl --pipe-cmd 'docker exec -i mycontainer perl' myscript.pl
remperl --pipe-cmd 'kubectl exec -i mypod -- perl' myscript.pl
remperl --pipe-cmd 'nice ssh hostx perl' myscript.pl

SECURITY

Authentication and access control are the transport's responsibility (SSH keys, container permissions, etc.).

Module serving (--serve-modules) is disabled by default. When enabled, the remote side can request any module by filename; the local side searches @INC and returns the source. Path traversal sequences (..) in module filenames are rejected. Only enable module serving with endpoints you trust or when the exposure of your local @INC contents is acceptable.

REQUIREMENTS

Perl 5.36 or later on both local and remote machines. No non-core modules required on either side.

BUGS

__DATA__ and __END__ sections in remote scripts are not currently supported. The code before the marker executes correctly, but <DATA> reads will not work.

SEE ALSO

Remote::Perl -- the library interface.

AUTHOR

Pied Crow <crow@cpan.org>

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.