Professional Web Applications Themes

Net::FTP crashes on ftp->get() - PERL Modules

I am having trouble getting my cgi script using Net::FTP to get a zip file from a remote server (Microsoft server) into the server where the script resides (UNIX freeBSD/Apache server). The browser ends up with a blank page, because the cgi script seems to crash whenever we get to ftp->get(). I used Komodo to test this script and it worked fine from my WindowsXP PC. But when the script is uploaded to the website server (UNIX freeBSD/Apache server) it fails to work properly. Any ideas what the problem could be? code: # setup ftp object $ftp = Net::FTP->new($host, Timeout=>240, ...

  1. #1

    Default Net::FTP crashes on ftp->get()

    I am having trouble getting my cgi script using Net::FTP to get a zip
    file from a remote server (Microsoft server) into the server where the
    script resides (UNIX freeBSD/Apache server). The browser ends up with a
    blank page, because the cgi script seems to crash whenever we get to
    ftp->get().

    I used Komodo to test this script and it worked fine from my WindowsXP
    PC. But when the script is uploaded to the website server (UNIX
    freeBSD/Apache server) it fails to work properly.

    Any ideas what the problem could be?


    code:

    # setup ftp object
    $ftp = Net::FTP->new($host, Timeout=>240, Debug => 1) or
    dienice ("Can't ftp to $host: $!\n");

    # Login to the ftp site as anonymous
    $ftp->login("anonymous") or $newerr = 1;
    if ($newerr) {
    $ftp->quit;
    &dienice ("Can't login to $host: $! $?\n");
    }

    # go to the directory containing the file
    $ftp->cwd($directory) or $newerr=1;
    if ($newerr) {
    $ftp->quit;
    &dienice ("Can't change to $directory: $!\n");
    }

    $ftp->binary(); # since we are transferring a zip file use binary
    instead of ascii

    #Get zip archive and place it on local server

    $ftp->get($filename, $filename) or $newerr=1;
    if ($newerr) {
    $success = $false; # failed file probably doesn't exist
    }
    else {
    $success = $true; # file was successfully transferred
    }

    $transferred_file = $filename; #save pathname of transferred file

    #disconnect from the ftp site
    $ftp->quit;

    rna8arnold Guest

  2. #2

    Default Re: Net::FTP crashes on ftp->get()


    "rna8arnold" <rna8arnoldaol.com> wrote in message
    news:1140129582.622597.277610o13g2000cwo.googlegr oups.com...
    > I am having trouble getting my cgi script using Net::FTP to get a zip
    > file from a remote server (Microsoft server) into the server where the
    > script resides (UNIX freeBSD/Apache server). The browser ends up with a
    > blank page, because the cgi script seems to crash whenever we get to
    > ftp->get().
    >
    > I used Komodo to test this script and it worked fine from my WindowsXP
    > PC. But when the script is uploaded to the website server (UNIX
    > freeBSD/Apache server) it fails to work properly.
    >
    > Any ideas what the problem could be?
    >
    >
    > code:
    >
    > # setup ftp object
    > $ftp = Net::FTP->new($host, Timeout=>240, Debug => 1) or
    > dienice ("Can't ftp to $host: $!\n");
    >
    > # Login to the ftp site as anonymous
    > $ftp->login("anonymous") or $newerr = 1;
    > if ($newerr) {
    > $ftp->quit;
    > &dienice ("Can't login to $host: $! $?\n");
    > }
    >
    > # go to the directory containing the file
    > $ftp->cwd($directory) or $newerr=1;
    > if ($newerr) {
    > $ftp->quit;
    > &dienice ("Can't change to $directory: $!\n");
    > }
    >
    > $ftp->binary(); # since we are transferring a zip file use binary
    > instead of ascii
    >
    > #Get zip archive and place it on local server
    >
    > $ftp->get($filename, $filename) or $newerr=1;
    > if ($newerr) {
    > $success = $false; # failed file probably doesn't exist
    > }
    > else {
    > $success = $true; # file was successfully transferred
    > }
    >
    > $transferred_file = $filename; #save pathname of transferred file
    >
    > #disconnect from the ftp site
    > $ftp->quit;
    >
    Could it be that the local (Unix) machine is unable to copy $filename to the
    location specified by $filename ? Perhaps a permissions issue .... or
    perhaps the Unix machine just can't cope when $filename is something like
    'C:\path\file.ext'.

    Cheers,
    Rob


    Sisyphus Guest

  3. #3

    Default Re: Net::FTP crashes on ftp->get()

    Sisyphus wrote:
    > "rna8arnold" <rna8arnoldaol.com> wrote in message
    > news:1140129582.622597.277610o13g2000cwo.googlegr oups.com...
    >
    >>I am having trouble getting my cgi script using Net::FTP to get a zip
    >>file from a remote server (Microsoft server) into the server where the
    >>script resides (UNIX freeBSD/Apache server). The browser ends up with a
    >>blank page, because the cgi script seems to crash whenever we get to
    >>ftp->get().
    >>
    >>I used Komodo to test this script and it worked fine from my WindowsXP
    >>PC. But when the script is uploaded to the website server (UNIX
    >>freeBSD/Apache server) it fails to work properly.
    >>
    >>Any ideas what the problem could be?
    >>
    >>
    >>code:
    >>
    >># setup ftp object
    >> $ftp = Net::FTP->new($host, Timeout=>240, Debug => 1) or
    >> dienice ("Can't ftp to $host: $!\n");
    >>
    >> # Login to the ftp site as anonymous
    >> $ftp->login("anonymous") or $newerr = 1;
    >> if ($newerr) {
    >> $ftp->quit;
    >> &dienice ("Can't login to $host: $! $?\n");
    >> }
    >>
    >> # go to the directory containing the file
    >> $ftp->cwd($directory) or $newerr=1;
    >> if ($newerr) {
    >> $ftp->quit;
    >> &dienice ("Can't change to $directory: $!\n");
    >> }
    >>
    >> $ftp->binary(); # since we are transferring a zip file use binary
    >>instead of ascii
    >>
    >> #Get zip archive and place it on local server
    >>
    >> $ftp->get($filename, $filename) or $newerr=1;
    >> if ($newerr) {
    >> $success = $false; # failed file probably doesn't exist
    >> }
    >> else {
    >> $success = $true; # file was successfully transferred
    >> }
    >>
    >> $transferred_file = $filename; #save pathname of transferred file
    >>
    >> #disconnect from the ftp site
    >> $ftp->quit;
    >>
    >
    >
    > Could it be that the local (Unix) machine is unable to copy $filename to the
    > location specified by $filename ? Perhaps a permissions issue .... or
    > perhaps the Unix machine just can't cope when $filename is something like
    > 'C:\path\file.ext'.
    >
    > Cheers,
    > Rob
    >
    >
    What error is FTP returning? It does not come back in $!, as your script
    seems to assume.

    Tom Wyant
    harryfmudd [AT] comcast [DOT] net Guest

Similar Threads

  1. cs3 crashes on mac
    By neverrx8 in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: May 18th, 10:22 PM
  2. LoadFile method: VBA crashes. Well, any othermethod crashes as well.
    By GSerg@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 7
    Last Post: July 20th, 03:45 PM
  3. crashes
    By RoyNoble in forum Macromedia Contribute General Discussion
    Replies: 2
    Last Post: April 17th, 11:56 AM
  4. PS 7 Crashes
    By Carl B. Johnson in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 0
    Last Post: July 22nd, 02:32 PM
  5. Win xp pro crashes when log off
    By David Colligan in forum Windows XP/2000/ME
    Replies: 0
    Last Post: July 9th, 03:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139