A user of one of my modules (File::Touch) sent me a bug report, complaining that his ActiveState Perl barfed on the following line:
sysopen my $fh,$file,O_WRONLY|O_CREAT|O_NONBLOCK|O_NOCTTY or croak("Can't create $file : $!");
The error message was "Your vendor has not defined Fcntl macro O_NONBLOCK, used at..."
So, I tweaked the code to check whether the Fcntl constant exists in the module's symbol table:
my $SYSOPEN_MODE = O_WRONLY|O_CREAT; if(exists $Fcntl::{'O_NONBLOCK'}){ $SYSOPEN_MODE |= &{ $Fcntl::{'O_NONBLOCK'} }; } if(exists $Fcntl::{'O_NOCTTY'}){ $SYSOPEN_MODE |= &{ $Fcntl::{'O_NOCTTY'} }; }
Strangely, the code causes an error at 'exists $Fcntl::{'O_NONBLOCK'}'. The error message is "Your vendor has not defined Fcntl macro O_NONBLOCK, used at File/Touch.pm line 16." The same error occurs with ActiveState 5.8 and 5.10.
Any ideas?
In reply to Fcntl constants missing by nwetters
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |