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
Short version: you have a dependency loop, and your code, as written,
can not work.
Longer version: main.pl loads Test1, which loads TestRole, which loads
TestGlue, which loads Test1. Boom!
On 2015-02-25 Daniel Hermann wrote:
> The above code works if
>
> - I do not 'use Test2' in TestGlue.pm o
To understand this you need to understand how Perl handles circular
dependencies.
When we execute code that loads other code (for instance use at
compile time, require at run time, or a variety of things in Moose),
Perl will mark the current package as incompletely loaded then go off
and try to lo
Is it possible to define a subtype that will provide a stringify method?
I see MooseX::Exception::Base::Stringify that can be provided as a trait for an
attribute, but that gets onerous (and error-prone) when *every* time you
declare an attribute that has "... isa => MyType ..." you want to also
Hi,
I have two classes Test1 and Test2, both consuming the role
TestRole which uses another class TestGlue, which in turn uses
Test1 and Test2 internally.
My main program uses Test1 and Test2 and runs into a Moose error
when it calls a method in Test2 provided by TestRole:
Can't locate objec