Subject: | unecessary dependency on unix 'ls' command |
Net::FTP::Recursive uses by default the 'ls' command to list directories.
This obviously won't work if that command isn't available, or is not in
the path (such as on Windows). Also, it can cause issues if the module
is used with Perl's taint checking turned on.
The latter can be worked around, by setting the $ENV{PATH} variable to
an untainted constant path, and the former can be by setting the
appropriate package variables ($options{DirCommand} and
$options{ParseSub}) and calling the appropriate private method (e.g.
_rput instead of rput).
However, this is entirely unnecessary. Perl can easily list the
contents of a directory without help from ls or any other external
commands, using opendir/readdir/closedir, or glob, and with much less
effort - the result doesn't need parsing.
On a cursory examination of the source, I think this could be trivially
fixed by internally setting $options with something like this:
$options{DirCommand} = '';
$options{ParseSub} = sub {
# list files in current directory here, create the necessary
# Net::FTP::Recursive::File objects, add them to @to_return
# ...
return @to_return;
}
Or better, rewriting the module to omit the need for such indirection.
(You don't really need $options{DirCommand}, even then, %options
probably shouldn't be a package variable, because that may mean multiple
Net::FTP::Recursive instances will interfere with each other's state.)
Hope this helps. I would supply patches if I had time, however I must
press on.