I like this code. I have three suggestions:
my %commands = ( 'LS' => \&lsftp, 'DIR' => \&dirftp, 'GET' => \&getftp, 'PUT' => \&putftp, 'DEL' => \&delftp, 'SIZE' => \&sizeftp, ); [...] my $cmd = $commands{$type}; if(&$cmd($value1, $value2) == 1) { sleep $idletime; next; }
It would take a little bit of work to make the interfaces for each command sub identical (or at least compatible), but I think the savings are worth it.
--
The hell with paco, vote for Erudil!
:wq
In reply to Re: ftp remote-editing script
by FoxtrotUniform
in thread ftp remote-editing script
by kodo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |