Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: net::Ftp::rercursive->rput
by marto (Cardinal) on Jun 23, 2006 at 13:57 UTC
Re: net::Ftp::rercursive->rput
by Asim (Hermit) on Jun 23, 2006 at 14:00 UTC

    Hi!

    UPDATE: I recommend you go with the examples noted above, rather than on the code below, which is untested. In paticular, I'm unable to test the assertion that rput works on *NIX in the manner I mention below.

    If you look at the docs for Net::FTP::Recursive, they do a pretty good job of explaining things from a Perl perspective. Here's an example of how the code might go, based on the docs for the module in question:

    # WARNING: Untested code! use strict; use warnings; use Net::FTP::Recursive; my $ftp = Net::FTP::Recursive->new("some.host.name", Debug => 0); $ftp->login("anonymous",'me@here.there'); #Change the directory in the below command # to the root of the directories you wish # to upload to $ftp->cwd('/pub'); # You must have your script in the proper # local directory; this module automatically # uploads it's working directory chdir('/home/user/data_to_upload'); # According to docs, rput should "just work" # on Unix-like systems $ftp->rput(); $ftp->quit();

    Unless I'm missing something? I hope that works for you; I don't have an FTP site here I can test with.

    ----Asim, known to some as Woodrow.

      hi it shows an error while executing the line $ftp->rput(); the error is 'ls-la' is not recognized as an internal or external command' '/' is current directory please resolve this

        Please don't take this wrong. Perhaps you've moved on and done what I'll say below, but I don't know, and I have to assume you have not.

        You'll note that I added a note to my original encouraging the use of the code marto posted first, over mine. In addition, I encouraged you to read the actual documentation for the class, which would have shown you where the ls -la bit comes from. And, I pointed out in the comment, and the code, that this is for Unix-like systems, which, based upon the error message you reported, you are not trying to FTP to.

        We are happy to help, and code snippets have been provided. Have you tried the code samples marto pointed you to? If my code does not work, the code from the modules' development team is much more likely to. And if it does not, please give us more data, as mentioned in How do I post a question effectively? and Perlmonks FAQ.

        Why? Because we've here to help, and it's best if you help us help you. Those documents will tell you how, and how to give info like the Operating Systems, which might just be your main issue. But I don't know that, and thus cannot help you resolve the issue.

        Bottom line: I CANNOT debug your error properly without you testing the other code sample, and providing more complete details about you goals. OK?

        ----Asim, known to some as Woodrow.