Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Net::MirrorDir help

by toolic (Bishop)
on Nov 16, 2011 at 15:00 UTC ( #938392=note: print w/replies, xml ) Need Help??

in reply to Net::MirrorDir help

Do you get more information if you enable debugging?
debug => 1, # 1 for yes, 0 for no
Poke around in the source code of the Net::MirrorDir module. It uses readdir which should handle filenames with spaces, but the following line looks suspicious:
@info = split(/\s+/, $line);
What you describe seems like a bug, which you can report.

Replies are listed 'Best First'.
Re^2: Net::MirrorDir help
by sunnyfedora99 (Novice) on Nov 17, 2011 at 10:54 UTC

    Setting Debug to 1 gives me the following output of the 'readdir'

    returnvalues from <dir(/dir3)> -rw-r----- 1 ftp ftp 420730 Nov 17 10:38 file with spac +e.pdf -rw-r----- 1 ftp ftp 956 Nov 16 16:33 mail.txt

    But when it shows the file which doesn't match it show the following:


    I've opened up a bug case, to get this issue fixed.

      A cursory glance at the module source reveals this gem:

      ... for my $line (@{$ra_lines}) { @info = split(/\s+/, $line); $name = $info[$#info]; ...

      So yes, filenames containing spaces are broken. A potential fix might be

      @info = split(/\s+/, $line, 9); # 9 columns in FTP output

      ... if one could be sure that each FTP server would return 9 columns of output. Another alternative could be to rely on the file date/time as a marker, or to try a fixed width parser for the ftp output, and checking that split /\s+/ always returns the same number of items.

      Here is a quote from the "Changes" file...
      0.14 Sat Feb 23 10:36:50 2008 - using the function "$self->{_connection}->dir($dir)" to the sea +rch of the directory the FTP-server should return the following format as response of +the LIST command: -r--r--r-- 1 ftpuser ftpusers 576 Feb 23 09:23 file.txt drwxrwxr-x 2 ftpuser ftpusers 512 Feb 21 13:54 Dir1 Directory- or filenames should not contain any white space. - add some tests
      It looks like the author was aware of the limitation.

        Ahhh, i've just seen that too. I've opened a case anyways, would be good to get that fixed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938392]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2018-01-18 22:37 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (215 votes). Check out past polls.