summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2016-02-16 08:50:08 +0000
committerSteve Hay <steve.m.hay@googlemail.com>2016-03-11 17:17:51 +0000
commit6156385671b2ccb3a54994d6c185a0b0b6b55bc2 (patch)
tree087e4b12151c2a90676c42abfbfd1c8602395a0d /ext
parent22e30cb2a3fd49a3d6fe5a866b28ff36608340ae (diff)
downloadperl-6156385671b2ccb3a54994d6c185a0b0b6b55bc2.tar.gz
Export Winsock error constants from Errno.pm
Diffstat (limited to 'ext')
-rw-r--r--ext/Errno/Errno_pm.PL28
1 files changed, 24 insertions, 4 deletions
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 1d9c048275..6251a3cf33 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
use Config;
use strict;
-our $VERSION = "1.24";
+our $VERSION = "1.25";
my %err = ();
@@ -76,9 +76,16 @@ sub process_file {
}
}
+ my $pat;
+ if ($IsMSWin32) {
+ $pat = '^\s*#\s*define\s+((?:WSA)?E\w+)\s+';
+ }
+ else {
+ $pat = '^\s*#\s*define\s+(E\w+)\s+';
+ }
while(<FH>) {
$err{$1} = 1
- if /^\s*#\s*define\s+(E\w+)\s+/;
+ if /$pat/;
}
close(FH);
@@ -358,7 +365,16 @@ ESQ
EUSERS EWOULDBLOCK EXDEV));
$k =~ s/(.{50,70})\s/$1\n\t/g;
- print "\t",$k,"\n )]\n);\n\n";
+ print "\t",$k,"\n )],\n";
+
+ if ($IsMSWin32) {
+ print " WINSOCK => [qw(\n";
+ $k = join(" ", grep { /^WSAE/ } keys %err);
+ $k =~ s/(.{50,70})\s/$1\n\t/g;
+ print "\t",$k,"\n )],\n";
+ }
+
+ print ");\n\n";
print <<'ESQ';
sub TIEHASH { bless \%err }
@@ -406,9 +422,13 @@ Errno - System errno constants
=head1 DESCRIPTION
C<Errno> defines and conditionally exports all the error constants
-defined in your system C<errno.h> include file. It has a single export
+defined in your system F<errno.h> include file. It has a single export
tag, C<:POSIX>, which will export all POSIX defined error numbers.
+On Windows, C<Errno> also defines and conditionally exports all the
+Winsock error constants defined in your system F<WinError.h> include
+file. These are included in a second export tag, C<:WINSOCK>.
+
C<Errno> also makes C<%!> magic such that each element of C<%!> has a
non-zero value only if C<$!> is set to that value. For example: