#!/usr/bin/perl -w
# 37M06SK - filetsts created by Pip@CPAN.org to run through perl file tests.

use strict;

my $file = shift || 'STDIN';
my @oper = ( 'r', 'readable',           'w', 'writable',
             'x', 'executable',         'o', 'owned',
             'R', 'readable by real',   'W', 'writable by real',
             'X', 'executable by real', 'O', 'owned by real',
             'e', 'exists',             'z', 'zero size',
             's', 'size',               'f', 'file',
             'd', 'directory',          'l', 'link',
             'p', 'named pipe (FIFO)',  'S', 'socket',
             'b', 'block special file', 'c', 'character special file',
             't', 'tty',                'u', 'setuid bit',
             'g', 'setgid bit',         'k', 'sticky bit',
             'T', 'Text',               'B', 'Binary',
             'M', 'age of file in days since Modification',
             'A', 'age of file in days since last Access',
             'C', 'age of file in days since mode Change',
           );
for(my $i = 0; $i < @oper; $i += 2) { 
  print "(-$oper[$i] $file) == (";
  if($oper[$i] =~ /[TB]/) { 
    print "Can't test! except in MS Windows?"; 
  } else { 
    eval("(-$oper[$i] \'$file\') ? print 1 : print 0;"); 
  }
  print ") : $oper[$i + 1]\n";
}
