Determine the mode of open files in Windows

The following code will give you the opening mode of the given handle ( <

, >

etc.):

use Fcntl qw(F_GETFL);
my $flags = fcntl($fh, F_GETFL, my $junk);

      

$flags

is a number indicating open mode (numbers defined by other macros provided by Fcntl). This, however, does not work on a Strawberry Perl installation. It fails with the following message:

Your vendor has not defined Fcntl macro F_GETFL

      

How can this be done when installing Windows on Perl?

The context is that I am looking into a fix for Data :: Transform :: ExplicitMetadata . Its purpose is to make Perl structures serializable via JSON, and one thing that needs to be done to serialize is open file descriptors. See the current code here .

+3


source to share





All Articles