Mouse fails under ModPerl::Registry
Hi, I'm using Mouse (2.4.5) under Debian testing (mod_perl 2.0.9, Perl 5.22.1). This simple test fails:
-
CGI:
package main; use CGI; require '/tmp/test.pm'; my $q = CGI->new(); print $q->header( -type => 'text/html' ); print '
OK'; -
Mouse package (/tmp/test.pm):
package My; use strict; use Mouse; has a => ( is => 'rw' ); 1;
-
Result in Apache logs when trying to load CGI:
No package name defined at /usr/lib/x86_64-linux-gnu/perl5/5.22/Mouse.pm line 137.\nBEGIN failed--compilation aborted at /tmp/test.pm line 4
I cannot reproduce this issue on Debian stable with Perl 5.20.2(libapache2-mod-perl2 2.0.9). Could you show us how to reproduce this issue in more detail(reproducing steps, Apache configuration etc) ?
It works with Debian stable and Ubuntu 15.10 but fails with Debian testing (mod_perl 2.0.9 and Perl 5.22.1). My Apache config is very simple:
<VirtualHost *:80>
ServerName test.example.com
# DocumentRoot
DocumentRoot /var/www/test
<Directory /var/www/test>
Require all granted
Options +ExecCGI +FollowSymLinks
</Directory>
# Perl script
<Files *.pl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Files>
</VirtualHost>
Hmm, I cannot reproduce on Debian testing(Perl 5.22.2, Apache 2.4.18-2, mod_perl, 2.0.9-4+b1).
Hello, it's a bit more complex (some Perl code was loaded). Here is an example that reproduce the problem:
Apache.conf:
PerlModule My
<VirtualHost *:80>
ServerName test.example.com
# DocumentRoot
DocumentRoot /var/www/test
<Directory /var/www/test>
Require all granted
Options +ExecCGI +FollowSymLinks
</Directory>
# Perl script
<Files *.pl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
</Files>
</VirtualHost>
test. pl:
package main;
use CGI;
use My2;
my $q = CGI->new();
print $q->header( -type => 'text/html' );
print '<html><body>OK</body></html>';
My.pm:
package My;
use strict;
use Mouse;
has a => ( is => 'rw' );
1;
My2.pm:
package My2;
use strict;
use Mouse;
has b => ( is => 'rw' );
1;
Hi, did you succeed to reproduce the bug ?
No. Could you give us Dockerfile which reproduces this issue ?
Hi, here is a Dockerfile with files mentioned above: mouse-bug-with-modperl.tar.gz
I can reproduce this issue with your Dockerfile. However is this Mouse issue ? I suppose this is ModPerl::Registry namespace handling issue. (However I don't understand namespace handling of ModPerl::Registry)
But it works with Moose... This error is generated by XS part of Mouse (xs-src/Mouse.xs, line 507). I don't understand why it doesn't find the Perl namespace here (My2) since it is well found by Moose.
I found this problem during Debian packaging of Lemonldap::NG.
Bug confirmed by Debian Perl Group