summaryrefslogtreecommitdiff
path: root/lib/File/stat.pm
diff options
context:
space:
mode:
authorchromatic <chromatic@wgz.org>2001-11-10 14:03:20 -0700
committerAbhijit Menon-Sen <ams@wiw.org>2001-11-11 03:25:13 +0000
commit2f173a711df6278f66c6ac17988528b6f9c306f0 (patch)
treeb74b099829d1146266d0349320c06383cabb49e4 /lib/File/stat.pm
parentc363d00ced22999ea0ccd93dad0a0f991636292f (diff)
downloadperl-2f173a711df6278f66c6ac17988528b6f9c306f0.tar.gz
(was Re: [ID 20011110.104] File::stat vs. $! conflict)
Message-Id: <20011111041025.12984.qmail@onion.perl.org> p4raw-id: //depot/perl@12938
Diffstat (limited to 'lib/File/stat.pm')
-rw-r--r--lib/File/stat.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/File/stat.pm b/lib/File/stat.pm
index accae9f559..0c479d21f4 100644
--- a/lib/File/stat.pm
+++ b/lib/File/stat.pm
@@ -48,9 +48,15 @@ sub stat ($) {
my $arg = shift;
my $st = populate(CORE::stat $arg);
return $st if $st;
- no strict 'refs';
- require Symbol;
- return populate(CORE::stat \*{Symbol::qualify($arg)});
+ my $fh;
+ {
+ local $!;
+ no strict 'refs';
+ require Symbol;
+ $fh = \*{Symbol::qualify($arg)};
+ return unless defined fileno $fh;
+ }
+ return populate(CORE::stat $fh);
}
1;