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_owner.pl < prev    next >
Perl Script  |  1992-03-10  |  398b  |  22 lines

  1. #
  2. #   This retrieves possibly cached owner of a file.
  3. # If it returns "BOGUS", it means that the stat failed.
  4.  
  5. package main;
  6. require 'stat.pl';
  7.  
  8. package file_owner;
  9.  
  10. sub main'Owner {
  11.     local($file) = @_;
  12.  
  13.     if (!defined $owners{$file}) {
  14.        if (&'Stat($file)) {
  15.            $owners{$file} = $'st_uid;
  16.        } else {
  17.            $owners{$file} = 'BOGUS';
  18.        }
  19.     }
  20.     $owners{$file};
  21. }
  22.