On Thu, Jul 18, 2002 at 10:33:45AM -0400, Nikola Janceski wrote:
> I think I have stumbled onto a bug. I'd like one of the gurus (Jeff, druiex,
> Jenda or any perlguy.com) to confirm that my test is correct or if I missed
> something in docs.

I'm not on that list, but I'll bite anyways :-)

> using Perl 5.6.1 on a Solaris sparc.
> 
> #perl
> use strict;
> use warnings;
> 
> my $wofile = "noread";        # text file with no read permissions
> my $file = "canread"; # text file with read perms
> 
> if( -T $file ){  # will be true
>       print "exists\n" if -e _;  # will print
>       } else {
>       print "doesn't exist\n" unless -e _;
>       }
> 
> ## here's the possible bug
> if( -T $wofile ){  # will be false (you need read to determine if text file)

                                      ^^^^^^ correct...
>       print "exists\n" if -e _;
>       } else {
>       print "doesn't exist\n" unless -e _;  # will print BUT SHOULDN'T

                                                           ^^^^^^ Why?!?

The 'stat' structure is used.  That structure has been filled by the -T,
since the file has been accessed, regardless of the fact that the test
for the 'text' type failed.

The stat structure contains properties that rely on the working
directories permissions and thus contains valid data.  File permissions
are irrelevant in that case.

Or am I missing something?

-- 
            Well, then let's give that Java-Wussie a beating... (me)

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |                       [EMAIL PROTECTED]
50733 Cologne                          |                 http://www.lamertz.net
Germany                                |               http://www.perl-ronin.de 

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

Reply via email to