Hi, I would like to log in to a tcp and get a file from there. Tried with this ;
require "ftp.pl"; $ftpHost = "x.x.x.x"; if (&ftp::open($ftpHost,21,0,1) != 1) { die "Can't open $ftpHost\n"; } if (&ftp::login("name","pwd") != 1) { die "Can't login to $ftpHost\n"; } if (($pwd = &ftp::pwd) eq "") { die "Can't get current directory\n"; } print "pwd = $pwd\n"; $newCwd = "/perl"; if (&ftp::cwd($newCwd) != 1) { die "Can't cwd to $newCwd \n"; } if (&ftp::dir_open !=1 ) { die "Can't open directory for reading\n"; } print "Directory listing for $newCwd:\n"; while (&ftp::read() > 0) { print $ftp::buf; } if (&ftp::dir_close != 1) { die "can't close directory read\n"; } $file = "x.pm"; print "Getting $file \n"; #if (&ftp::get($file,"NewName") != 1) if (&ftp::get($file) != 1) { die "Can't get $file\n"; } &ftp::close;
but it gave me this :
Can't locate sys/socket.ph in @INC (did you run h2ph?) (@INC contains: /usr/lib/perl5/5.6.1/i386-lin ux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /us r/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /us r/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/5.6.1/chat2.pl line 18

I checked and there is no sys/socket.ph. May I know what the problem is and how to solve it ?

next step is, I need to put this into the web, how do I integrate the file into website or what CGI should I write to execute(trigger) this program ? Thanks

Edit: Added <code> tags, larsen

edited by ybiC: retitle from "tcp cnx"


In reply to ftp.pl to retrieve a file by tja_ariani

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.