Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

How can I FTP files from within PERL WITHOUT NET::FTP?

( #41328=categorized question: print w/ replies, xml ) Need Help??
Contributed by bigtiny on Nov 13, 2000 at 20:12 UTC
Q&A  > HTTP and FTP clients


Description:

I need to write a tool that includes FTP. I cannot depend on additional modules that may or may not have been downloaded from CPAN, so I'm going to assume that NET::FTP is NOT part of the PERL5 distribution that comes on our AIX boxes (BTW...how can I display a list of the modules included in the distribution?). thanks, bigtiny

Answer: How can I FTP files from within PERL WITHOUT NET::FTP?
contributed by Fastolfe

If you've resigned yourself to reinventing the wheel, I suggest taking a look at Net::FTP and using some of the code in that module. Just because you don't feel you can rely on its presence doesn't mean you can't use some of the same code.

Additionally, check out the CPAN module for ways of programmatically determining what modules are installed and what versions they are. Note that CPAN probably requires some LWP:: or Net:: modules, so that may be out as well.

Answer: How can I FTP files from within PERL WITHOUT NET::FTP?
contributed by Anonymous Monk

Hi,how about you try to play around with this code.It includes an FTP process.I'm trying to use UNIX embedded command inside the program, instead of using the NET::FTP.

#!/usr/bin/perl print "Content-type:text/html\n\n"; use File::Copy; $remotehost1 ="a"; $remotepath ="/b"; $remoteuser ="c"; $remotepass ="d"; @fileftp = qw(x.wml y.wml z.wml); $cmd="ftp -n"; foreach $wmlfile (@fileftp) { if(-f $wmlfile) { $ftp_commands = " open $remotehost1 user $remoteuser $remotepass cd $remotepath asc put $wmlfile bye "; open (CMD, "|$cmd"); print CMD $ftp_commands; close (CMD); print "File $wmlfile has been transferred \n"; print "<br>\n"; $finish = 'transfer'; copy ("$wmlfile","./$finish/$wmlfile"); } }

Hope,it will help. -VREMPIRE-

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (14)
    As of 2014-09-30 17:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (379 votes), past polls