Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Net::MirrorDir help

by toolic (Chancellor)
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.


Comment on Re: Net::MirrorDir help
Select or Download Code
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:

    /dir3/space.pdf...

    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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938392]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (16)
As of 2014-07-11 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (234 votes), past polls