… | |
… | |
247 | |
247 | |
248 | use AnyEvent; |
248 | use AnyEvent; |
249 | use AnyEvent::Fork::Util; |
249 | use AnyEvent::Fork::Util; |
250 | use AnyEvent::Util (); |
250 | use AnyEvent::Util (); |
251 | |
251 | |
|
|
252 | our $VERSION = $AnyEvent::Fork::Util::VERSION; |
|
|
253 | |
252 | our $PERL; # the path to the perl interpreter, deduces with various forms of magic |
254 | our $PERL; # the path to the perl interpreter, deduces with various forms of magic |
253 | |
255 | |
254 | =item my $pool = new AnyEvent::Fork key => value... |
256 | =item my $pool = new AnyEvent::Fork key => value... |
255 | |
257 | |
256 | Create a new process pool. The following named parameters are supported: |
258 | Create a new process pool. The following named parameters are supported: |
… | |
… | |
272 | |
274 | |
273 | #TODO: maybe append the packet to any existing string command already in the queue |
275 | #TODO: maybe append the packet to any existing string command already in the queue |
274 | |
276 | |
275 | # ideally, we would want to use "a (w/a)*" as format string, but perl versions |
277 | # ideally, we would want to use "a (w/a)*" as format string, but perl versions |
276 | # from at least 5.8.9 to 5.16.3 are all buggy and can't unpack it. |
278 | # from at least 5.8.9 to 5.16.3 are all buggy and can't unpack it. |
277 | push @{ $self->[2] }, pack "N/a", pack "(w/a)*", @_; |
279 | push @{ $self->[2] }, pack "N/a*", pack "(w/a*)*", @_; |
278 | |
280 | |
279 | $self->[3] ||= AE::io $self->[1], 1, sub { |
281 | $self->[3] ||= AE::io $self->[1], 1, sub { |
280 | # send the next "thing" in the queue - either a reference to an fh, |
282 | # send the next "thing" in the queue - either a reference to an fh, |
281 | # or a plain string. |
283 | # or a plain string. |
282 | |
284 | |