in reply to Re: Re: Struggles with Put in Net::FTP
in thread Struggles with Put in Net::FTP

OK, to make use of File::Spec, look at the following sample:

use File::Spec; my $file_path=File::Spec->catfile('C:','Path','To','File.exe'); print "$file_path\n";

This will print:

C:\Path\To\File.exe

The advantage is, the module will put in the directory seperators for you, as appropriate for the OS. Also, you don't have to remember to escape the '\' character in a Windows path (basically making things cleaner). Also, it looks like you've got debug turned on, what kind of messages is it Net::FTP giving you?

Replies are listed 'Best First'.
Re: Re: Re: Re: Struggles with Put in Net::FTP
by mchiles (Initiate) on May 26, 2004 at 15:43 UTC
    Thanks, I tried that and it formatted the path for me nicely so I know what the proper format should be... I think.

    I just posted a reply to the other monk on the thread who suggested that I may not be using Net::FTP as intended. Which makes me wonder if I am using File::Spec as intended... I ran the script as followed from a script on my linux host:
    use File::Spec; my $file_path=File::Spec->catfile('E:','test','picture.jpg'); print "File Path $file_path\n";
    It gave me the result File Path E:/test/picture.jpg which is good. But is that result the correct result for my home Win98 PC or is it actually the result for my linux host?

    -Matt :)