Skip Menu |

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

Report information
The Basics
Id: 14467
Status: rejected
Priority: 0/
Queue: Net-FTP-Recursive

People
Owner: texasjdl [...] yahoo.com
Requestors: baer [...] jff-lan.com
Cc:
AdminCc:

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



Subject: Windows compatibility for the rput Command
The rput() Command doesn't work under Windows 2000 Professional. Because the "ls -la" (used in the Recursive.pm) command doesn't return user/group like linux. So the rput funktion can't get a filelist to put. Maybe it is possible to implement an windows/linux switch for the "ls -la" command. thanks Clemens
Windows 2000 Professional ls -la total 1051 drwxrwxrwx 1 0 Sep 2 14:22 . drwxrwxrwx 1 0 Sep 2 14:22 .. drwxrwxrwx 1 0 Sep 2 13:39 asdasd -rwxrwxrwx 1 537648 Sep 2 13:39 cgi-bin.rar -rwxrwxrwx 1 539629 Sep 2 13:39 cgi-bin.rar2 drwxrwxrwx 1 0 Sep 2 13:39 olderdasdasd -rwxrwxrwx 1 300 Sep 2 14:27 test Debian ls -la insgesamt 1062 drwxrwxrwx 4 azubi azubi 1024 5. Sep 06:08 . drwxr-xr-x 5 azubi azubi 1024 5. Sep 05:49 .. drwxr-x--- 3 azubi azubi 1024 5. Sep 06:08 asdasd -rw-r----- 1 azubi azubi 535674 5. Sep 06:08 cgi-bin.rar -rw-r----- 1 azubi azubi 537648 5. Sep 06:08 cgi-bin.rar2 drwxr-x--- 3 azubi azubi 1024 5. Sep 06:08 olderdasdasd -rw-r----- 1 azubi azubi 293 5. Sep 06:08 test
[guest - Mon Sep 5 02:17:20 2005]: Show quoted text
> The rput() Command doesn't work under Windows 2000 Professional. > Because the "ls -la" (used in the Recursive.pm) command doesn't return > user/group like linux. So the rput funktion can't get a filelist to > put. > > Maybe it is possible to implement an windows/linux switch for the "ls > -la" command. > > > thanks Clemens
Hi there, Actually, the module already has functionality that should allow you to use it. When using any of the methods, you can utilize the ParseSub option to pass a ref to a sub that the module will use to parse each line of the output from the directory listing. If you look at the parse_files subroutine in the module, that will give you a good idea of what to do. In this particular case, you'd want something like: sub myParseSub{ my(@to_return) = (); foreach my $line (@_){ #rough regex, haven't tested this at all.. #cygwin's ls does return the user/group on my system next unless my @fields = $line =! /^(?=[-d])(\S+)\s+ #permissions, only get dir and file (\d+)\s+ #link count (\d+)\s+ #size (.*) #etc. it's 3am, I'm lazy :) (?<!\S)(?!\.{1,2}\W)(\S+) #filename $ /x; my @args; if( $fields[0] =~ /^d/ ){ push @to_return, Net::FTP::Recursive::File->new( qw/IsPlainFile 0 IsDirectory 1 IsSymlink 0/, OriginalLine, $line, Fields, [@fields]); } else { #this must be a regular file, as per the (?=[-d]) push @to_return, Net::FTP::Recursive::File->new( qw/IsPlainFile 1 IsDirectory 0 IsSymlink 0/, OriginalLine, $line, Fields, [@fields]); } } return @to_return; } then when you call rput: $ftp->rput(ParseSub => \&myParseSub); I would be all for implementing a switch that would do this sort of thing, but given all of the variations in what system environment people use, the switches would grow out of control. I'd rather just empower you to implement a little code that allows you to tailor to any system where you may need it. Feel free to respond! jdl
From: clemens
yeah! thank you! that was very helpful. It works after some litte changes depending on my system! Some general thing: I think "OriginalLine" should be declared in " " otherwise perl introduce 'OriginalLine' and the 'Fields' as a command. Thank you for help! greetings clemens PS: I saw that my emailadress is printed on my first posting. Can somebody remove my adress? I don't want that some spambots get my adress ... Thx!
[guest - Tue Sep 6 08:54:26 2005]: Show quoted text
> I think "OriginalLine" should be declared in " " otherwise perl > introduce 'OriginalLine' and the 'Fields' as a command.
That's what I get for writing off-the-cuff code at 3am! :)
On Mon Sep 05 02:17:20 2005, guest wrote: Show quoted text
> The rput() Command doesn't work under Windows 2000 Professional. > Because the "ls -la" (used in the Recursive.pm) command doesn't return > user/group like linux. So the rput funktion can't get a filelist to > put. > > Maybe it is possible to implement an windows/linux switch for the "ls > -la" command. > > > thanks Clemens
I have a similar problem with the module: DB<9> $ftp->rput(); 'ls' is not recognized as an internal or external command, operable program or batch file. I don't have cygwin or any other add-ons installed, so I don't have an ls on my system. Is this a requirement?
From: Jeremiah
On Wed Feb 22 14:22:58 2006, guest wrote: Show quoted text
> On Mon Sep 05 02:17:20 2005, guest wrote:
> > The rput() Command doesn't work under Windows 2000 Professional. > > Because the "ls -la" (used in the Recursive.pm) command doesn't return > > user/group like linux. So the rput funktion can't get a filelist to > > put. > > > > Maybe it is possible to implement an windows/linux switch for the "ls > > -la" command. > > > > > > thanks Clemens
> > I have a similar problem with the module: > > DB<9> $ftp->rput(); > 'ls' is not recognized as an internal or external command, > operable program or batch file. > > > I don't have cygwin or any other add-ons installed, so I don't have an > ls on my system. Is this a requirement?
Right now, the answer is yes. If you look in the docs for my email address and contact me directly, I may be able to provide you the relevant code. I believe I already have this implemented in some code that I have at home, but I won't be home for another 4-5 hours. jdl
From: Jeremiah
On Wed Feb 22 14:35:09 2006, guest wrote: Show quoted text
> On Wed Feb 22 14:22:58 2006, guest wrote:
> > I have a similar problem with the module: > > > > DB<9> $ftp->rput(); > > 'ls' is not recognized as an internal or external command, > > operable program or batch file. > > > > > > I don't have cygwin or any other add-ons installed, so I don't have an > > ls on my system. Is this a requirement?
> > Right now, the answer is yes. If you look in the docs for my email > address and contact me directly, I may be able to provide you the > relevant code. I believe I already have this implemented in some code > that I have at home, but I won't be home for another 4-5 hours.
Actually, the other day I was wrong. Currently, there is a switch, called DirCommand, that you can set, that will allow you to give it your own command to use for listing the local directory. That option, in concert with the ParseSub option, allows you to create as flexible a solution as you need. One of the feature requests that I have in the queue is switching from this methodology to using an opendir/readdir to get the local files. That should keep it platform independent without having to deal with the parsing. I thought I had that more implemented than I currently do. The next version should include it, though. jdl