1N/A# Class::Struct forbids use of @ISA 1N/A map { $_ =>
'$' }
qw{
1N/A return unless defined fileno $
fh;
1N/AFile::stat - by-name interface to Perl's built-in stat() functions 1N/A $st = stat($file) or die "No $file: $!"; 1N/A if ( ($st->mode & 0111) && $st->nlink > 1) ) { 1N/A print "$file is executable with lotsa links\n"; 1N/A use File::stat qw(:FIELDS); 1N/A stat($file) or die "No $file: $!"; 1N/A if ( ($st_mode & 0111) && $st_nlink > 1) ) { 1N/A print "$file is executable with lotsa links\n"; 1N/AThis module's default exports override the core stat() 1N/Aand lstat() functions, replacing them with versions that return 1N/A"File::stat" objects. This object has methods that 1N/Areturn the similarly named structure field name from the 1N/Astat(2) function; namely, 1N/AYou may also import all the structure fields directly into your namespace 1N/Aas regular variables using the :FIELDS import tag. (Note that this still 1N/Aoverrides your stat() and lstat() functions.) Access these fields as 1N/Avariables named with a preceding C<st_> in front their method names. 1N/AThus, C<$stat_obj-E<gt>dev()> corresponds to $st_dev if you import 1N/ATo access this functionality without the core overrides, 1N/Apass the C<use> an empty import list, and then access 1N/Afunction functions with their full qualified names. 1N/AOn the other hand, the built-ins are still available 1N/Avia the C<CORE::> pseudo-package. 1N/AAs of Perl 5.8.0 after using this module you cannot use the implicit 1N/AC<$_> or the special filehandle C<_> with stat() or lstat(), trying 1N/Ato do so leads into strange errors. The workaround is for C<$_> to 1N/A my $stat_obj = stat $_; 1N/Aand for C<_> to explicitly populate the object using the unexported 1N/Aand undocumented populate() function with CORE::stat(): 1N/A my $stat_obj = File::stat::populate(CORE::stat(_)); 1N/AWhile this class is currently implemented using the Class::Struct 1N/Amodule to build a struct-like class, you shouldn't rely upon this.