NAME
Win32::Fmode - determine whether a Win32 filehandle is opened for reading, writing , or both.
SYNOPSIS
use warnings;
use Win32::Fmode;
.
.
my $mode = fmode( \*FH ); # FH is an open filehandle
FUNCTIONS
The purpose is to work around the MS C runtime libraries lack of a function to retrieve the file mode used when a file is opened.
Exports a single function: fmode
Pass it an open Perl filehandle and it will return a numeric value that represents the mode parameter used on the open.
fmode( \*FILEHANDLE ) & 1 and print "is readonly";
fmode( \*FILEHANDLE ) & 2 and print "is writeonly";
fmode( \*FILEHANDLE ) & 128 and print "is read/write";
If the parameter passed is not an open filehandle, the call will raise an exception.
BUGS
Note: Ram files c<open FH, '<', \$ram> are not true filehandles (they are tied globs), and therefore do not have the associated CRT FILE structure from which this module obtains the information, and no way has yet been found to retrieve that information from them.
The module IO::String suffers the same limitations.
LICENSE
This program is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.
AUTHOR & COPYRIGHT
Written by BrowserUK.
Copyright BrowserUK.
bug reports to BrowserUk@cpan.org