Thanks for this great lesson, I will take account for this on my furture =))


----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: "LI NGOK LAM" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, July 25, 2003 12:17 AM
Subject: Re: Checking for a directory


> ------------------------------------------------
> On Thu, 24 Jul 2003 23:20:20 +0800, "LI NGOK LAM" <[EMAIL PROTECTED]> wrote:
>
> > Yep ! =)
> >
> > Even though I can't imagine what a path is not file or directory would
imply
> > more then not exist. But I agree to check the existence for a path by -e
> > is the safest operation.
> >
>
> Since you asked ;-) from perldoc -f -e ....
>
> -l  File is a symbolic link.
> -p  File is a named pipe (FIFO), or Filehandle is a pipe.
> -S  File is a socket.
> -b  File is a block special file.
> -c  File is a character special file.
>
> -f implies that a file is 'plain' aka not really special in any way. Files
come in many different flavors not only based on their contents, though this
is largely system dependent. Most windows and old Mac OS users will go their
whole life not knowing about these (I said not "knowing about" and "most",
not that they don't exist there, personally I am not sure they do or don't,
but then I don't much care either :-) )...
>
> If you have access to a fairly standard unix system try:
>
> perl -e 'if (-f "/dev/tty0") { print "File is plain.\n"; } else { if (-e
"/dev/tty0") { print "File is not plain, but does exist.\n" } }'
>
> The issue was not with whether -f will tell you of non-existence, because
it will, but by using your 'else' block you were implying non-existence by
not being a plain file and not a directory, which is an incorrect (strictly
speaking) implication.
>
> http://danconia.org
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to