my $pid; if ( $pid = fork ) { #parent gets child pid local $| = 1; my $res; { sleep 1; print "\rUpdating $file...", sprintf "%-5dk retrieved", ( -s $localfile || 0 ) / 1024 unless $opt{q}; redo unless ( $res = waitpid $pid, WNOHANG ); } print STDERR $res ? " ... done!\n" : " ... failed!\n" unless $opt{q}; return $res?$localfile:0; } else { $SIG{INT} = sub { print STDERR 'Removing incomplete download...'; unlink $localfile or print STDERR "\rCouldn't remove incomplete ". "download of $localfile: $!\n" }; exit is_success( getstore( $uri, $localfile ) ); }