This should work with a gateway, this is working code with some modified names.

my $gsRemoteMachine = "ftp.site.com"; my $gsRemoteDir = "/"; my $gsFtpId = "username"; my $gsFtpPwd = "password"; my $gsGateMachine = "gateway.site.com"; # ftp gateway my $gsGateConnect = "\@$gsRemoteMachine "; # remote machine connect +id for gateway my $gsRemoteMachine = $gsGateMachine; my $gsFeedsDir = "/mypath/"; my $gsFeedFile = "myfile"; system("ftp -n $RemoteMachine <<EOF> $StatusFile 2>&1\n\nuser $gsFtpId +$gsGateConnect $gsFtpPwd\nverbose\n$gsFtpMode\nput $gsFeedsDir$gsFeed +File $gsRemoteDir$gsFeedFile\nclose\nbye\nEOF");
Update:Posted this real early this morning, didn't really put any meaningful comments. Note that the above is only tested on a unix box (HPUX), but should work as is on any *nix. The contents of "$StatusFile" would look about like:
Verbose mode on.
200 Type set to I.
200 PORT command successful.
150 Opening BINARY mode data connection for xxxxxxx.gz.
226 Transfer complete.
720203 bytes sent in 5.00 seconds (140.57 Kbytes/s)
221- Goodbye...
221  Total bytes retrieved: 0   stored: 720203

Without Net::FTP one needs to open the $StatusFile and read it in to determine if it succeeded/failed.

I have more on this very issue, in a previous node here Improving an FTP process that discusses FTPing this way, and why I migrated such code to Net::FTP


In reply to Re: FTP within PERL script WITHOUT NET::FTP? by wardk
in thread FTP within PERL script WITHOUT NET::FTP? by bigtiny

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.