in reply to Re: Read part of a file over FTP
in thread Read part of a file over FTP

Yes, this is what I wanted! Thanks very much!

As a follow up question, the buffer now returns the first file in my loop, and I get the text that I want, but fails on the second with the error: Can't call method "read" on an undefined value. However, I have verified that the new filename is correct, so I assume that there must be some problem with reinitializing the dataconn object?

Is there a recommended way to clear a retr() so that a new one can be called? Or is that not even likely to be my problem?

Relevant code is below: The while loop is on a MySQL query return. Note that I haven't done anything with the buffer yet.
while (@results = $filequery->fetchrow()) { $filename="/".$filename; print "$filename\n"; $xfr = $ftp->retr($filename); $xfr->read($header,1400); print "$header\n"; }

Replies are listed 'Best First'.
Re^3: Read part of a file over FTP
by ronin78 (Novice) on May 27, 2011 at 19:32 UTC
    Note, for the above code, that I have tried the following things to close the retr():
    $ftp->close(); $xfr->close();
    But no joy. I'm just stabbing in the dark, though, so that's not really surprising.

      Use $xfr->abort; to abort the retr, and $ftp->quit to close the connection.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      Fantastic! Sorry if my questions are noobish, and thanks very much for the help.

      Matt