home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / perl / file_mode.pl < prev    next >
Perl Script  |  1992-03-10  |  414b  |  24 lines

  1. #
  2. #  This retrieves a possibly cached mode on file.
  3. # If it returns "BOGUS", it means that the stat failed.
  4. #
  5. # tchrist@convex.com
  6.  
  7. package main;
  8. require 'stat.pl';
  9.  
  10. package file_mode;
  11.  
  12. sub main'Mode {
  13.     local($file) = @_;
  14.  
  15.     if (!defined $modes{$file}) {
  16.        if (&'Stat($file)) {
  17.            $modes{$file} = $'st_mode;
  18.        } else {
  19.            $modes{$file} = 'BOGUS';
  20.        }
  21.     }
  22.     $modes{$file};
  23. }
  24.