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

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

by bigtiny (Acolyte)
on Nov 13, 2000 at 20:12 UTC ( [id://41328]=perlquestion: print w/replies, xml ) Need Help??

bigtiny has asked for the wisdom of the Perl Monks concerning the following question: (http and ftp clients)

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

Originally posted as a Categorized Question.

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

Replies are listed 'Best First'.
Re: How can I FTP files from within PERL WITHOUT NET::FTP?
by Fastolfe (Vicar) on Nov 13, 2000 at 20:19 UTC
    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.

Re: How can I FTP files from within PERL WITHOUT NET::FTP?
by Anonymous Monk on Nov 14, 2000 at 13:00 UTC
    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-

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found