p5-Mouse icon indicating copy to clipboard operation
p5-Mouse copied to clipboard

Mouse fails under ModPerl::Registry

Open guimard opened this issue 9 years ago • 10 comments

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

guimard avatar May 03 '16 04:05 guimard

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

syohex avatar May 03 '16 05:05 syohex

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>

guimard avatar May 03 '16 07:05 guimard

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

syohex avatar May 08 '16 03:05 syohex

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 avatar May 10 '16 03:05 guimard

Hi, did you succeed to reproduce the bug ?

guimard avatar May 16 '16 06:05 guimard

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

syohex avatar May 16 '16 07:05 syohex

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

guimard avatar May 16 '16 16:05 guimard

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)

syohex avatar May 16 '16 23:05 syohex

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 avatar May 17 '16 04:05 guimard

Bug confirmed by Debian Perl Group

guimard avatar May 22 '16 17:05 guimard