CPAN 0.12 does not even compile on VC perl
C:\sources\Sys-Sendfile-0.12>perl build test | more
cl -nologo -c -nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -G7 -GL -DWIN32 -D_CONSOLE -D
NO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_HASH_FUNC_ONE_AT_A_TIME -DNO_MATHOMS -
DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -O1
-MD -Zi -DNDEBUG -G7 -GL "-DXS_VERSION=\"0.12\"" "-DVERSION=\"0.12\"" -I"C:\perl
521\lib\CORE" -I"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\include"
-Fo"lib\Sys\Sendfile.obj" "lib\Sys\Sendfile.c"
Sendfile.c
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\MSWSo
ck.h(77) : error C2061: syntax error : identifier 'FAR'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\MSWSo
ck.h(77) : error C2059: syntax error : ';'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\MSWSo
ck.h(79) : error C2146: syntax error : missing ')' before identifier 's'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\MSWSo
ck.h(79) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unkno
Show quoted textwn>'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\MSWSo
ck.h(79) : error C2144: syntax error : '<Unknown>' should be preceded by '<Unkno
Show quoted textwn>'
between 0.11 and 0.12, the headers were rearranged so that mswsock.h in #included before all other headers, in 0.11 it looks like mswsock.h was included after perl.h (which pulled in windows.h) MS (IDK about mingw's version) mswsock.h has an include guard, but has no #include'es inside of it. "FAR" token is #defined to something else in the SDK headers, but none were included before mswsock.h so yeah. I replaced
#include <mswsock.h>
with
#include <windows.h>
as a quick hack and it compiled.
5.21, -O1, callstack args may be wrong
-----------------------------------------------
Finished generating code
if exist "blib\arch\auto\Sys\Sendfile\Sendfile.dll.manifest" mt -nologo -manifes
t "blib\arch\auto\Sys\Sendfile\Sendfile.dll.manifest" -outputresource:"blib\arch
\auto\Sys\Sendfile\Sendfile.dll";2
t\00-compile.t ............ ok
t\10-basics.t .............
# Failed test 'Wrote 1089 bytes when asked to send the whole file'
# at t\10-basics.t line 21.
# got: undef
# expected: '1089'
t\10-basics.t ............. 1/4
****HANG******
-----------------------------------------------
ntdll.dll!_KiFastSystemCallRet@0()
ntdll.dll!_ZwDeviceIoControlFile@40() + 0xc
mswsock.dll!_WSPRecv@36() + 0xd1
mswsock.dll!_WSPRecvFrom@44() + 0xe099
ws2_32.dll!_recvfrom@24() + 0x87
perl521.dll!win32_recvfrom(unsigned int s=0x00000004, char * buf=0x00dd5024, int len=0x00000441, int flags=0x00000000, sockaddr * from=0x0012f878, int * fromlen=0x0012fcbc) Line 481 + 0x34 C
perl521.dll!PerlSockRecvfrom(IPerlSock * piPerl=0x00366350, unsigned int s=0x00000004, char * buffer=0x00dd5024, int len=0x00000441, int flags=0x00000000, sockaddr * from=0x0012f878, int * fromlen=0x0012fcbc) Line 1389 + 0x17 C
perl521.dll!Perl_pp_sysread(interpreter * my_perl=0x00000400) Line 1724 + 0x1d C
perl521.dll!Perl_runops_standard(interpreter * my_perl=0x00364084) Line 41 + 0x4 C
perl521.dll!S_run_body(interpreter * my_perl=0x00000790, long oldscope=0x00000001) Line 2423 + 0xa C
perl521.dll!perl_run(interpreter * my_perl=0x00364084) Line 2346 + 0x8 C
perl521.dll!RunPerl(int argc=0x00000006, char * * argv=0x01362cf0, char * * env=0x00363180) Line 258 + 0x6 C
perl.exe!mainCRTStartup() Line 398 + 0xe C
kernel32.dll!_BaseProcessStart@4() + 0x23
---------------------------------------------
curcop is line 22 in t\10-basics.t
---------------------------------------------
#!perl -T
use strict;
use warnings;
use Test::More tests => 4;
use Sys::Sendfile;
use Fcntl 'SEEK_SET';
use IO::Socket::INET;
alarm 2;
my $bound = IO::Socket::INET->new(Listen => 1, ReuseAddr => 1, LocalAddr => 'localhost') or die "Couldn't make listening socket: $!";
my $in = IO::Socket::INET->new(PeerHost => $bound->sockhost, PeerPort => $bound->sockport) or die "Couldn't make input socket: $!";
my $out = $bound->accept;
open my $self, '<', $0 or die "Couldn't open self: $!";
my $slurped = do { local $/; <$self> };
seek $self, 0, SEEK_SET or die "Could not seek: $!";
my $size = -s $self;
is(sendfile($out, $self, $size), $size, "Wrote $size bytes when asked to send the whole file");
defined recv $in, my $read, -s $self, 0 or die "Couldn't receive: $!";<<<<<<<<<<<<LINE 22
is($read, $slurped, "Read the same as was written");