xslate / p5-Mouse

Lightweight class builder for Perl, as a subset of Moose
https://metacpan.org/release/Mouse
Other
46 stars 32 forks source link

Mouse fails under ModPerl::Registry #60

Open guimard opened 8 years ago

guimard commented 8 years ago

Hi, I'm using Mouse (2.4.5) under Debian testing (mod_perl 2.0.9, Perl 5.22.1). This simple test fails:

syohex commented 8 years ago

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) ?

guimard commented 8 years ago

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>
syohex commented 8 years ago

Hmm, I cannot reproduce on Debian testing(Perl 5.22.2, Apache 2.4.18-2, mod_perl, 2.0.9-4+b1).

guimard commented 8 years ago

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;
guimard commented 8 years ago

Hi, did you succeed to reproduce the bug ?

syohex commented 8 years ago

No. Could you give us Dockerfile which reproduces this issue ?

guimard commented 8 years ago

Hi, here is a Dockerfile with files mentioned above: mouse-bug-with-modperl.tar.gz

syohex commented 8 years ago

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)

guimard commented 8 years ago

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.

guimard commented 8 years ago

Bug confirmed by Debian Perl Group