Skip Menu |

This queue is for tickets about the Net-FTP-Recursive CPAN distribution.

Report information
The Basics
Id: 27695
Status: resolved
Worked: 5 hours (300 min)
Priority: 0/
Queue: Net-FTP-Recursive

People
Owner: texasjdl [...] yahoo.com
Requestors: nickwoolley [...] yahoo.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.00
Fixed in: (no value)



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.
I have resolved the dependency on "ls" in v2.01. Incidentally, I did a bunch of code cleanup, though I didn't yet refactor out the globals.