perl... how to tell if a piped command is still running?

I'm using the fabulous perl. I need a way to tell when a piped call to "open" has completed. Can I do this with a command like <ShellPipe> ??

Reason behind this:

I'm trying to write a backup script in perl! This script will download a certain file from my web server, to my computer.

Now, this perl script calls wget something like this:

open( ShellPipe, "wget http://url.com" );

Is there some way to get wget to delete the file if the file download got interupted? Otherwise I'll have a partially downloaded backup!

My script is smart enough, that it will try again if the file doesn't exist, you see. But what if the download got interupted? Then a file will exist, and I'll have a bad backup.

I know it's unlikely to get interupted, but I like to take care and be very sure of these things :slight_smile:

Also, my webserver does not tell me the size of the file to be downloaded. It tells you when there is no more data, though.

So for this reason, I just need to tell when the pipe has been completed.