.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Object::Remote::Role::Connector::PerlInterpreter 3pm" .TH Object::Remote::Role::Connector::PerlInterpreter 3pm "2022-10-26" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Object::Remote::Role::Connector::PerlInterpreter \- Role for connections to a Perl interpreter .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Object::Remote; \& \& my %opts = ( \& perl_command => [qw(nice \-n 10 perl \-)], \& watchdog_timeout => 120, stderr => \e*STDERR, \& ); \& \& my $local_connection = Object::Remote\->connect(\*(Aq\-\*(Aq, %opts); \& my $hostname = Sys::Hostname\->can::on($remote, \*(Aqhostname\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the role that supports connections to a Perl interpreter that is executed in a different process. The new Perl interpreter can be either on the local or a remote machine and is configurable via arguments passed to the constructor. .SH "ARGUMENTS" .IX Header "ARGUMENTS" .IP "perl_command" 4 .IX Item "perl_command" By default the Perl interpreter will be executed as \*(L"perl \-\*(R" but this can be changed by providing an array reference as the value to the perl_command attribute during construction. .IP "stderr" 4 .IX Item "stderr" If this value is defined then it will be used as the file handle that receives the output of \s-1STDERR\s0 from the Perl interpreter process and I/O will be performed by the run loop in a non-blocking way. If the value is undefined then \s-1STDERR\s0 of the remote process will be connected directly to \s-1STDERR\s0 of the local process with out the run loop managing I/O. The default value is undefined. .Sp There are a few ways to use this feature. By default the behavior is to form one unified \s-1STDERR\s0 across all of the Perl interpreters including the local one. For small scale and quick operation this offers a predictable and easy to use way to get at error messages generated anywhere. If the local Perl interpreter crashes then the remote Perl interpreters still have an active \s-1STDERR\s0 and it is possible to still receive output from them. This is generally a good thing but can cause issues. .Sp When using a file handle as the output for \s-1STDERR\s0 once the local Perl interpreter is no longer running there is no longer a valid \s-1STDERR\s0 for the remote interpreters to send data to. This means that it is no longer possible to receive error output from the remote interpreters and that the shell will start to kill off the child processes. Passing a reference to \s-1STDERR\s0 for the local interpreter (as the \s-1SYNOPSIS\s0 shows) causes the run loop to manage I/O, one unified \s-1STDERR\s0 for all Perl interpreters that ends as soon as the local interpreter process does, and the shell will start killing children when the local interpreter exits. .Sp It is also possible to pass in a file handle that has been opened for writing. This would be useful for logging the output of the remote interpreter directly into a dedicated file. .IP "watchdog_timeout" 4 .IX Item "watchdog_timeout" If this value is defined then it will be used as the number of seconds the watchdog will wait for an update before it terminates the Perl interpreter process. The default value is undefined and will not use the watchdog. See \f(CW\*(C`Object::Remote::Watchdog\*(C'\fR for more information. .SH "SEE ALSO" .IX Header "SEE ALSO" .ie n .IP """Object::Remote""" 4 .el .IP "\f(CWObject::Remote\fR" 4 .IX Item "Object::Remote"