On Tue Jan 15 00:10:56 2002, jamie wrote: > This is a bug report for perl from jamie@shareable.org, > generated with the help of perlbug 1.28 running under perl v5.6.0. > > > ----------------------------------------------------------------- > [Please enter your report here] > > I use the following code to generate file handles, as per the perlref > manpage: > > local *FILE; > open FILE, "<blahblah" or die "Error opening \`blahblah': $!\n"; > return *FILE{IO}; > > For the most part, this has the same effect as returning *FILE, and > seems cleaner. The perlref manpage seems to recommend this, although > the perlfaq5 page seems to prefer the *FILE approach. > > Although this works fine with functions like `read', `write', > `sysread' > etc., it generates an unexpected result with `stat', `lstat' and the > `-X' file test operators. > > Specifically, when one of these *FILE{IO} references is used in the > file > test functions, including `stat' and `lstat', it's converted to a > string > (i.e. "IO::Handle=IO(0x12345678)"), and that is used as the file name > to > test. > > On the other hand, when a typeglob *FILE is used in a file test > function, the fstat() system call is used on the open file as > expected. > > Is this a code discrepancy or something that should be documented in > the > perlfunc manpage? > > Cheers, > -- Jamie Lokier > Sorry about not responding to this earlier. This problem has been fixed with change #28628.Thread Previous | Thread Next