[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Odd behaviour with -d ?



At 10:26 96-03-15, Alan Fry wrote:

>In other words MacPerl seems to lose the ability to discern file types
>unless the script is in the same directory as the files themselves. The
>list of names however is correct. Is this how Perl is supposed to behave, I
>wonder?

MacPerl (or Perl) doesn't loose the ability.  You asked it to check the
type of files in the current directory, regardless of where the file
reside!  Either change the current directory beforehand:
    chdir( $dir ) || die( "Can't cd to '$dir': $!\n" );
    opendir( HERE, ':' )....
or use the given directory in the file tests:
    if (-d "$dir$title")...

--Hal
Hal Wine <hal@dtor.com>     voice: 510/482-0597