home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5284 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  2.5 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!mips!darwin.sura.net!jvnc.net!synapse.bms.com!synapse!anderson
  2. From: anderson@zymurgy.bms.com (Jay Anderson)
  3. Newsgroups: comp.lang.perl
  4. Subject: help with ftp.pl/chat2.pl
  5. Message-ID: <ANDERSON.92Aug12175926@zymurgy.bms.com>
  6. Date: 12 Aug 92 22:59:26 GMT
  7. Sender: news@synapse.bms.com
  8. Distribution: comp.lang.perl
  9. Organization: BMS Pharmaceutical Research Institute
  10. Lines: 74
  11.  
  12. I'm trying to use ftp.pl without too much success.  I keep getting bombed out in
  13. the eval of the following loop (really from chat2.pl).  Any ideas of what's going
  14. awry?
  15.  
  16.  
  17. &ftp'open( some_real_site.on.the.net, 21, 1, 1 )
  18. sub expectloop000001 {
  19.     LOOP: {
  20.         if (0) { ; }
  21.         elsif ($S =~ /^(221 .*)\015\n/) {
  22.             $S = $';
  23.              package ftp;
  24.             &ftp'expectgot( $1, 0 ); 1;
  25.         }
  26.         elsif ($S =~ /^(500 .*)\015\n/) {
  27.             $S = $';
  28.              package ftp;
  29.             &ftp'expectgot( $1, 0 ); 0;
  30.         }
  31.         elsif ($S =~ /^(.*)\015\n/) {
  32.             $S = $';
  33.              package ftp;
  34.             &ftp'expectgot( $1, 0 ); 100;
  35.         }
  36.         elsif ($timeout) {
  37.              package ftp;
  38.             &ftp'expectgot( "timed out", 1 ); 0;
  39.         }
  40.         elsif ($eof) {
  41.              package ftp;
  42.             &ftp'expectgot( "remote server gone away", 1 ); 0;
  43.         }
  44.         else {
  45.             $rmask = "";
  46.             vec($rmask,fileno(S),1) = 1;
  47.             ($nfound, $rmask) =
  48.                  select($rmask, undef, undef, $endtime - time);
  49.             if ($nfound) {
  50.                 $nread = sysread(S, $thisbuf, 1024);
  51.                 if ($nread > 0) {
  52.                     $S .= $thisbuf;
  53.                 } else {
  54.                     $eof++, redo LOOP; # any error is also eof
  55.                 }
  56.             } else {
  57.                 $timeout++, redo LOOP; # timeout
  58.             }
  59.             redo LOOP;
  60.         }
  61.     }
  62. }
  63. :
  64. syntax error in file (eval) at line 2, next 2 tokens "LOOP:"
  65. syntax error in file (eval) at line 4, next 2 tokens "}
  66.         elsif"
  67. syntax error in file (eval) at line 8, next 2 tokens "}"
  68. syntax error in file (eval) at line 13, next 2 tokens "}"
  69. syntax error in file (eval) at line 18, next 2 tokens "}"
  70. syntax error in file (eval) at line 22, next 2 tokens "}"
  71. syntax error in file (eval) at line 26, next 2 tokens "}"
  72. syntax error in file (eval) at line 43, next 2 tokens "}"
  73.  
  74.  
  75.  
  76.  
  77.  
  78. --
  79. +---------------------------------------------------------------------+
  80. | Jay Anderson - N3JMC          Internet: anderson@optical.bms.com    |
  81. | Bristol-Myers Squibb Company      Work: (609)-252-6039              |
  82. | Princeton, NJ 08543               Home: (215)-836-1225              |
  83. | I have a dinosaur for a representative, he has a small brain and    |
  84. |    refuses to learn.                                                |
  85. +=====================================================================+
  86.