Re: Perl Async .10
am 03.10.2006 03:35:15 von Sisyphus"Todd English"
..
..
>
> The expected output would be 20 lines printed to the console saying the
> following:
>
> What happens instead is that some of lines fail to print the "I have
> returned" part of the message.
..
..
> ----------------sample code------------------
> #!/usr/bin/perl -w
>
> use strict;
> use Async;
>
> sub long_running_computation {
> system qq{find ./ -type f 2>&1 >/dev/null};
> return "I have returned";
> }
>
> my %proc_result;
> my %build_result;
>
> for (my $counter=0; $counter < 20; $counter++)
> {
> $proc_result{$counter} = Async->new( sub{
> long_running_computation() } );
> }
>
> while ( my ($name, $proc) = each %proc_result)
> {
> $build_result{$name} = $proc->result('1');
> }
>
> while (my($host_name, $result) = each %build_result)
> {
> printf "%s\t%s\n", $host_name, $result;
> }
>
Is the problem dependent upon that system() command, or do you get the same
problem even if you replace the system call with something else ?
I replaced the system call with sleep(2) as I didn't want to mess around
with system(). I get 20 lines of "
That's on Win32 (2000), perl 5.8.8, Async-0.10.
Cheers,
Rob