… | |
… | |
125 | use Carp (); |
125 | use Carp (); |
126 | use Errno (); |
126 | use Errno (); |
127 | |
127 | |
128 | use AnyEvent (); |
128 | use AnyEvent (); |
129 | |
129 | |
130 | our $VERSION = 0.2; |
130 | our $VERSION = '1.0'; |
131 | |
131 | |
132 | # xored together must start and and with \n |
132 | # xored together must start and and with \n |
133 | my $magic0 = "Pdk{6y[_zZ"; |
133 | my $magic0 = "Pdk{6y[_zZ"; |
134 | my $magic1 = "Z^yZ7~i=oP"; |
134 | my $magic1 = "Z^yZ7~i=oP"; |
135 | |
135 | |
… | |
… | |
426 | my $fh = shift |
426 | my $fh = shift |
427 | or die "AnyEvent::Fork::Remote: create callback failed"; |
427 | or die "AnyEvent::Fork::Remote: create callback failed"; |
428 | |
428 | |
429 | my $owner = length $ENV{HOSTNAME} ? "$ENV{HOSTNAME}:$$" : "*:$$"; |
429 | my $owner = length $ENV{HOSTNAME} ? "$ENV{HOSTNAME}:$$" : "*:$$"; |
430 | |
430 | |
431 | my $code = 'BEGIN { $0 = ' . (sq "$func of $owner") . '; ' . $self->[1] . "}\n" |
431 | my $code = 'BEGIN { $0 = ' . (sq "$owner $func") . '; ' . $self->[1] . "}\n" |
432 | . 'syswrite STDOUT, ' . (sq $magic0) . '^' . (sq $magic1) . ';' |
432 | . 'syswrite STDOUT, ' . (sq $magic0) . '^' . (sq $magic1) . ';' |
433 | . '{ sysread STDIN, my $dummy, 1 }' |
433 | . '{ sysread STDIN, my $dummy, 1 }' |
434 | . "\n$func*STDIN," . (aq @{ $self->[2] }) . ';' |
434 | . "\n$func*STDIN," . (aq @{ $self->[2] }) . ';' |
435 | . "\n__END__\n"; |
435 | . "\n__END__\n"; |
436 | |
436 | |