develooper Front page | perl.moose | Postings from February 2015

Bug in Moose, Moo or forks?

Thread Next
From:
Octavian Rasnita
Date:
February 26, 2015 05:26
Subject:
Bug in Moose, Moo or forks?
Message ID:
9C792A43B94F4D0EA9B1CB006ECF017A@octavianf303f0
Hello,

I have the following test code. Here Moose and Moo are not useful so can be 
commented, but in production code they are needed.

use forks;
use Moose;
use Moo;

$SIG{__DIE__} = sub {
    print "thread died: @_\n" if @_;
    exit;
};

my $thread = threads->create( sub { print "Thread running\n"; } );
$thread->join;

If it is ran with:
perl 5, version 16, subversion 3 (v5.16.3) built for i686-linux
Moose 2.0801
Moo 1.000008
forks 0.36

then it gives the following error:

thread died: Use of uninitialized value $name in hash element at 
/home/teddy/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/Moo/HandleMoose.pm 
line 52.

If either "use Moose;" or "use Moo;" are commented, the program works fine 
and prints "Thread running", so either Moose or Moo have a fatal effect 
here.

If the code above is ran with:
perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Moose 2.1403
Moo 1.007
forks 0.36

then it gives another error:

thread died: Can't use string ("Moo::HandleMoose::FakeMetaClass") as a HASH 
ref while "strict refs" in use at 
/usr/local/share/perl5/Moo/HandleMoose/FakeMetaClass.pm line 13.

If either "use Moose;" or "use Moo;" are commented, the code also works 
fine.

Do you have any idea what could be the problem?

Thanks.

--Octavian


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About