… | |
… | |
256 | |
256 | |
257 | my $stderr = $cv->recv; |
257 | my $stderr = $cv->recv; |
258 | |
258 | |
259 | =head2 For stingy users: put the worker code into a C<DATA> section. |
259 | =head2 For stingy users: put the worker code into a C<DATA> section. |
260 | |
260 | |
261 | When you want to be stingy with files, you cna put your code into the |
261 | When you want to be stingy with files, you can put your code into the |
262 | C<DATA> section of your module (or program): |
262 | C<DATA> section of your module (or program): |
263 | |
263 | |
264 | use AnyEvent::Fork; |
264 | use AnyEvent::Fork; |
265 | |
265 | |
266 | AnyEvent::Fork |
266 | AnyEvent::Fork |
… | |
… | |
276 | |
276 | |
277 | =head2 For stingy standalone programs: do not rely on external files at |
277 | =head2 For stingy standalone programs: do not rely on external files at |
278 | all. |
278 | all. |
279 | |
279 | |
280 | For single-file scripts it can be inconvenient to rely on external |
280 | For single-file scripts it can be inconvenient to rely on external |
281 | files - even when using < C<DATA> section, you still need to C<exec> |
281 | files - even when using a C<DATA> section, you still need to C<exec> an |
282 | an external perl interpreter, which might not be available when using |
282 | external perl interpreter, which might not be available when using |
283 | L<App::Staticperl>, L<Urlader> or L<PAR::Packer> for example. |
283 | L<App::Staticperl>, L<Urlader> or L<PAR::Packer> for example. |
284 | |
284 | |
285 | Two modules help here - L<AnyEvent::Fork::Early> forks a template process |
285 | Two modules help here - L<AnyEvent::Fork::Early> forks a template process |
286 | for all further calls to C<new_exec>, and L<AnyEvent::Fork::Template> |
286 | for all further calls to C<new_exec>, and L<AnyEvent::Fork::Template> |
287 | forks the main program as a template process. |
287 | forks the main program as a template process. |