home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5556 < prev    next >
Encoding:
Text File  |  1992-08-27  |  894 b   |  28 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: got a symlink checker/chaser for crontab?
  5. Message-ID: <mcook.714929577@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <17544@autodesk.COM> <mcook.714926334@fendahl.dev.cdx.mot.com>
  10. Date: Thu, 27 Aug 1992 15:32:57 GMT
  11. Lines: 15
  12.  
  13. I wrote:
  14.  
  15. >If it's an invalid symlink, you can lstat it, but you can't stat it.
  16.  
  17. >while (<>)
  18. >{
  19.      chop;          # <---- (oops!  you'll need this!) <-----
  20. >    next unless lstat($_);
  21. >    next unless -l _;
  22. >    next if stat($_);
  23. >    print "invalid symbolic link: $_ -> ",
  24. >        (readlink($_) || "[can't readlink: $!]"), "\n";
  25. >}
  26.  
  27. Michael.
  28.