home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl_ste.zip / auto / Net / FTP / _extract_path.al < prev    next >
Text File  |  1997-11-28  |  569b  |  24 lines

  1. # NOTE: Derived from ./blib/lib/Net/FTP.pm.  Changes made here will be lost.
  2. package Net::FTP;
  3.  
  4. ##
  5. ## Private methods
  6. ##
  7.  
  8. sub _extract_path
  9. {
  10.  my($ftp, $path) = @_;
  11.  
  12.  # This tries to work both with and without the quote doubling
  13.  # convention (RFC 959 requires it, but the first 3 servers I checked
  14.  # didn't implement it).  It will fail on a server which uses a quote in
  15.  # the message which isn't a part of or surrounding the path.
  16.  $ftp->ok &&
  17.     $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/ &&
  18.     ($path = $1) =~ s/\"\"/\"/g;
  19.  
  20.  $path;
  21. }
  22.  
  23. 1;
  24.