Module doesn't work under 5.20.1
Hi there,
I tried using this module under 5.20.1 and I get the following errors:
Parse error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 84. syntax error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 84, near "$;" syntax error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 84, near "{ no strict " Parse error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 86. syntax error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 86, near "$;" syntax error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 86, near ";my" Global symbol "$s" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 86. Global symbol "$s" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 87. Global symbol "@a" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 87. Global symbol "@a" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 87. Global symbol "@a" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 87. Global symbol "$s" requires explicit package name at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 88. syntax error at /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm line 89, near ";}" /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm has too many errors.
Is this something you could look into supporting? I suspect this is related to the function prototypes?
Edit file /opt/perl/lib/site_perl/5.20.1/AnyEvent/HTTP/Server/Kit.pm The first line maybe looks like 'package blib/lib::AnyEvent::HTTP::Server::Kit;' So you muct change to 'package AnyEvent::HTTP::Server::Kit;'
That doesn't seem to be the problem in my case. The Package line is as it is supposed to be, still:
Parse error at /home/ep/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/AnyEvent/HTTP/Server/Kit.pm line 84.
syntax error at /home/ep/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/AnyEvent/HTTP/Server/Kit.pm line 84, near "$;"
syntax error at /home/ep/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/AnyEvent/HTTP/Server/Kit.pm line 84, near "{ no strict "
This is my patch. It drops the prototypes and makes it magically working again. I don't understand why and how it breaks down, but this is a temporary fix.
My perl is: This is perl 5, version 20, subversion 0 (v5.20.0) built for x86_64-linux
--- AnyEvent/HTTP/Server/Kit.pm.original 2015-11-24 15:59:48.000000000 +0000
+++ AnyEvent/HTTP/Server/Kit.pm 2016-01-15 08:42:48.965467466 +0000
@@ -81,9 +81,9 @@
return;
}
-sub xd ($;$) { no strict 'refs';
+sub xd { no strict 'refs';
if( eval{ require Devel::Hexdump; 1 }) { *{ caller().'::xd' } = \&Devel::Hexdump::xd; }
- else { *{ caller().'::xd' } = sub($;$) { my@a=unpack'(H2)*',$_[0];my$s='';
+ else { *{ caller().'::xd' } = sub { my@a=unpack'(H2)*',$_[0];my$s='';
$s .= "@a[ $_*16 .. $_*16 + 7 ] @a[ $_*16+8 .. $_*16 + 15 ]\n" for (0..$#a/16);
return $s;
};}