home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / MacPerl 5.1.3 / Mac_Perl_513_src / perl5.002 / lib / validate.pl < prev    next >
Encoding:
Text File  |  1996-07-11  |  1.2 KB  |  35 lines  |  [TEXT/MPS ]

  1. ;# $RCSfile: validate.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:24:19 $
  2.  
  3. ;# The validate routine takes a single multiline string consisting of
  4. ;# lines containing a filename plus a file test to try on it.  (The
  5. ;# file test may also be a 'cd', causing subsequent relative filenames
  6. ;# to be interpreted relative to that directory.)  After the file test
  7. ;# you may put '|| die' to make it a fatal error if the file test fails.
  8. ;# The default is '|| warn'.  The file test may optionally have a ! prepended
  9. ;# to test for the opposite condition.  If you do a cd and then list some
  10. ;# relative filenames, you may want to indent them slightly for readability.
  11. ;# If you supply your own "die" or "warn" message, you can use $file to
  12. ;# interpolate the filename.
  13.  
  14. ;# Filetests may be bunched:  -rwx tests for all of -r, -w and -x.
  15. ;# Only the first failed test of the bunch will produce a warning.
  16.  
  17. ;# The routine returns the number of warnings issued.
  18.  
  19. ;# Usage:
  20. ;#    require "validate.pl";
  21. ;#    $warnings += do validate('
  22. ;#    /vmunix            -e || die
  23. ;#    /boot            -e || die
  24. ;#    /bin            cd
  25. ;#        csh            -ex
  26. ;#        csh            !-ug
  27. ;#        sh            -ex
  28. ;#        sh            !-ug
  29. ;#    /usr            -d || warn "What happened to $file?\n"
  30. ;#    ');
  31.  
  32. use File::CheckTree;
  33.  
  34. 1;
  35.