… | |
… | |
71 | We use C<new_execp> to execute the first F<perl> found in the PATH. You'll |
71 | We use C<new_execp> to execute the first F<perl> found in the PATH. You'll |
72 | have to make sure there is one for this to work. The perl does not |
72 | have to make sure there is one for this to work. The perl does not |
73 | actually have to be the same perl as the one running the example, and it |
73 | actually have to be the same perl as the one running the example, and it |
74 | doesn't need to have any modules installed. |
74 | doesn't need to have any modules installed. |
75 | |
75 | |
76 | The reason we have to specif< C<perl> twice is that the first argument to |
76 | The reason we have to specify C<perl> twice is that the first argument to |
77 | C<new_execp> (and also C<new_exec>) is the program name or path, while |
77 | C<new_execp> (and also C<new_exec>) is the program name or path, while |
78 | the remaining ones are the arguments, and the first argument passed to a |
78 | the remaining ones are the arguments, and the first argument passed to a |
79 | program is the program name, so it has to be specified twice. |
79 | program is the program name, so it has to be specified twice. |
80 | |
80 | |
81 | Finally, the standard example, send some numbers to the remote function, |
81 | Finally, the standard example, send some numbers to the remote function, |
… | |
… | |
236 | |
236 | |
237 | sub new_from_fh { |
237 | sub new_from_fh { |
238 | my ($class, @fh) = @_; |
238 | my ($class, @fh) = @_; |
239 | |
239 | |
240 | $class->new (sub { |
240 | $class->new (sub { |
241 | shift @fh |
241 | my $fh = shift @fh |
242 | or Carp::croak "AnyEvent::Fork::Remote::new_from_fh does not support fork"; |
242 | or Carp::croak "AnyEvent::Fork::Remote::new_from_fh does not support fork"; |
|
|
243 | |
|
|
244 | $_[0]($fh); |
243 | }); |
245 | }); |
244 | } |
246 | } |
245 | |
247 | |
246 | sub _new_exec { |
248 | sub _new_exec { |
247 | my $p = pop; |
249 | my $p = pop; |