Subject: | Class Bar is not loaded, cannot unpack. |
I have a data structure similar to the following.
package Foo;
use Moose;
use MooseX::Storage;
has 'bar' => (is => 'rw', isa => 'Bar');
1;
package Bar;
use Moose;
use MooseX::Storage;
has 'thingy' => (is => 'rw', isa 'Int');
1;
when unpacking the data, the second level 'Bar' object is not unpacked,
it generates an error.
'Class Bar is not loaded, cannot unpack'
This is because I have not 'use'd or 'require'd the class in my code,
but doing so is very inconvenient since I would need to know in advance
what all the possible class names are which, because I am creating the
classes using a Plugin system, I don't.
My (possibly over-simplistic) solution is to add the following line in
MooseX::Storage::Engine
167: eval "require $class";
168: my $meta = eval { $class->meta };
I can't see any reason not to do this but perhaps you can see a better
solution?
Regards
Ian