X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FRole%2FConnector%2FPerlInterpreter.pm;h=ccbb74f36b081abd0cf1bbc1e5974f788e72b87d;hp=23ff0ea96d42ad578c59e57a5c8132c4a6673372;hb=1a2d795fd41e8560892ba92d1088f2bc81b01d21;hpb=fbd3b8ecbd2c9004f0e56ff1c0bc30f677a19c62 diff --git a/lib/Object/Remote/Role/Connector/PerlInterpreter.pm b/lib/Object/Remote/Role/Connector/PerlInterpreter.pm index 23ff0ea..ccbb74f 100644 --- a/lib/Object/Remote/Role/Connector/PerlInterpreter.pm +++ b/lib/Object/Remote/Role/Connector/PerlInterpreter.pm @@ -19,6 +19,10 @@ sub _build_module_sender { return $hook ? $hook->sender : Object::Remote::ModuleSender->new; } +has perl_command => (is => 'lazy'); + +sub _build_perl_command { [ 'perl', '-' ] } + around connect => sub { my ($orig, $self) = (shift, shift); my $f = $self->$start::start($orig => @_); @@ -37,14 +41,14 @@ around connect => sub { } 2; }; -sub _perl_command { 'perl', '-' } +sub final_perl_command { shift->perl_command } sub _start_perl { my $self = shift; my $pid = open2( my $foreign_stdout, my $foreign_stdin, - $self->_perl_command(@_), + @{$self->final_perl_command}, ) or die "Failed to run perl at '$_[0]': $!"; return ($foreign_stdin, $foreign_stdout, $pid); } @@ -89,6 +93,7 @@ END $text .= "ENDFAT\n"; $text .= <<'END'; eval $Object::Remote::FatNode::DATA; +die $@ if $@; END $text .= "__END__\n"; return $text;