logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

IO::File::WithFilename - filehandles that know their origin

Author

       Ivan Fomichev, <ifomichev@cpan.org>

Description

       This module does everything that "IO::File" does, but implements "filename" method, that "File::Temp"
       objects have. It lets you write the code that is ignorant of what classes of objects it works with.

       If you want to check if it is safe to call "filename" method, you are recommended to call "can" method
       rather than to check an object's inheritance:

           print $obj->filename, "\n" if eval { $obj->can('filename') };

   EXPORT
       Same as "IO::File", i. e. "O_XXX" constants from the "Fcntl" module (if this module is available).

Name

       IO::File::WithFilename - filehandles that know their origin

See Also

       IO::File, File::Temp

Synopsis

           use IO::File::WithFilename;

           my $fh = IO::File::WithFilename->new('../movies/kin-dza-dza.ogg', O_RDONLY);
           print $fh->filename, "\n";
           print "$fh\n"; # same as above

See Also