Hello, Adam Theo here;

i was wondering if there is something i must declare to use file tests 
such as -d and -e? i have code which i am working on, and i need to 
check to see if a file is a directory. if it is, i run a subroutine.

i recall having used file tests before, and successfully. i don't recall 
having to declare anything special to use them, such as 'use File::Test' 
or something like that. i just used it in the code, like any other core 
perl function/operator.

here is the bit of code relevant to the file tests. through 'print' and 
data::dumper, i have isolated the root of my problem. it is that the 
file tests are not being done. the perl interpreter doesn't seem to know 
to check if the file is a directory, and just skips over it, going on to 
the final 'else' loop, even though it knows of the file, and can do 
other stuff with it, just not file tests.

sub check_source {
     my($source_dir, $source_file) = @_;
     print("Checking $source_dir/$source_file.\n");
     if ($source_file =~ /^\./) {
       print("Can't open file '$source_dir/$source_file':
         System file.\n");
     }
     elsif (-d $source_file) {
       print("$source_dir/$source_file is a directory.\n");
       $source_dir = "$source_dir/$source_file";
       &get_sources($source_dir);
     }
     elsif ($source_file =~ /(\.xml)$/) {
       print("$source_dir/$source_file is a source file.\n");
       &parse_source($source_dir, $source_file);
     }
     else {
       print("No match!\n");
     }
}

thanks in advance!
--
   /\   Theoretic Solutions (www.Theoretic.com):
  //\\    'Activism, Software, and Internet Services'
//--\\ Personal Homepage (www.Theoretic.com/adamtheo/):
   ][     'Personal history, analysis, and favorites'
   ][   Birthright Online (www.Birthright.net):
          'Keeping the best role-playing game alive'
Email & Jabber:                   Other:
-Professional: [EMAIL PROTECTED]  -AIM: AdamTheo2000
-General: [EMAIL PROTECTED]   -ICQ: 3617307
-Personal: [EMAIL PROTECTED]      -Phone: (850)8936047

Reply via email to