intrance has asked for the wisdom of the Perl Monks concerning the following question:
Hi! If there is not much trouble I would like to ask something myself. I searched but found nothing on this. I use the code below to get something from FTP but I can't abort(). I want to be able to read from <STDIN> while downloading and if the command is abort then stop the transfer. Can you see anything wrong in my code? Thanks
sub getfile(){ my $file = $_[0]; my $pid; if (!defined($pid = fork())) { die "cannot fork: $!"; } elsif ($pid) { while (1){ my $command = <STDIN>; chomp($command); if($command =~ m/^\s*abort\s*/){ $ftp->abort(); last; } } } else { $ftp->get($file); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Aborting ftp
by ww (Archbishop) on Dec 29, 2008 at 16:29 UTC | |
|
Re: Aborting ftp
by Marshall (Canon) on Dec 29, 2008 at 16:59 UTC | |
|
Re: Aborting ftp
by intrance (Initiate) on Dec 29, 2008 at 20:52 UTC | |
by Marshall (Canon) on Dec 29, 2008 at 22:17 UTC | |
by intrance (Initiate) on Dec 30, 2008 at 16:12 UTC | |
by Marshall (Canon) on Jan 01, 2009 at 06:06 UTC | |
by intrance (Initiate) on Jan 01, 2009 at 17:30 UTC | |
by Marshall (Canon) on Jan 01, 2009 at 01:31 UTC |