Skip to content

No $self in sub() with lazy => 1 and mod_perl with Apache MPM worker #28

@coudot

Description

@coudot

We have a strange bug in LemonLDAP::NG: https://jira.ow2.org/browse/LEMONLDAP-723

It seems that Mouse, with Perl v5.10.1, running inside Apache mod_perl with the MPM worker cannot run this kind of code:

has 'registerUrl' => (
    is      => 'rw',
    isa     => 'Str',
    default => sub {
        my $self = shift;
        return $self->portal . "register.pl";
    },
    lazy          => 1,
    documentation => 'URL of register page',
);

The error we see in Apache is:

[Tue Jul 15 14:12:17 2014] [error] Exception caught: Can't call method "portal" on an undefined value at /usr/share/perl5/vendor_perl/Lemonldap/NG/Common/Conf/Attributes.pm line 951.\n

I tried to use Mouse 2.3.0, but same error.

I can't reprodure with a more recent version of Perl (v5.18.2), or with MPM prefork.

Clément.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions