Subject: | Broken Types.pm using MooX::Types |
I'm not able to get CHI running out of the box. The problem can be reproduced eg.:
22:31:58 ツ ~/ > perl -e 'use CHI; CHI->new(driver => 'File');'
Must define a 'from' namespace for the parent type: CODE(0x25ec298) when defining type: Duration at /home/spechtan/workspace/JEP/lib//CHI/Types.pm line 56
Compilation failed in require at /usr/lib64/perl5/vendor_perl/5.12.4/CHI/Driver/Role/HasSubcaches.pm line 6.
BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.12.4/CHI/Driver/Role/HasSubcaches.pm line 6.
Compilation failed in require at /usr/lib64/perl5/vendor_perl/5.12.4/CHI/Driver.pm line 9.
BEGIN failed--compilation aborted at /usr/lib64/perl5/vendor_perl/5.12.4/CHI/Driver.pm line 9.
Compilation failed in require at /usr/lib64/perl5/vendor_perl/5.12.4/Module/Runtime.pm line 317.
Compilation failed in require at /usr/lib64/perl5/vendor_perl/5.12.4/Module/Runtime.pm line 317.
I've attached a small patch (which is not perfect - but if works around the issue at least).
Subject: | fix-moox-type-compatibility-issue.patch |
diff --git a/lib/CHI/Types.pm b/lib/CHI/Types.pm
index f4d349a..1a883e3 100644
--- a/lib/CHI/Types.pm
+++ b/lib/CHI/Types.pm
@@ -24,6 +24,7 @@ MooX::Types::MooseLike::register_types([
{
name => 'Duration',
subtype_of => PositiveInt,
+ from => 'MooX::Types::MooseLike::Numeric',
test => sub { 1 },
message => sub { return exception_message($_[0], 'a positive integer') },
inflate => 0,
@@ -31,6 +32,7 @@ MooX::Types::MooseLike::register_types([
{
name => 'MemorySize',
subtype_of => PositiveInt,
+ from => 'MooX::Types::MooseLike::Numeric',
test => sub { 1 },
message => sub { return exception_message($_[0], 'a positive integer') },
inflate => 0,
@@ -43,14 +45,16 @@ MooX::Types::MooseLike::register_types([
},
{
name => 'Serializer',
- subtype_of => Object,
+# subtype_of => Object,
+# from => 'MooX::Types::MooseLike::Base',
test => sub { 1 },
message => sub { return exception_message($_[0], 'a serializer, hashref, or string') },
inflate => 0,
},
{
name => 'Digester',
- subtype_of => Object,
+# subtype_of => Object,
+# from => 'MooX::Types::MooseLike::Base',
test => sub { 1 },
message => sub { return exception_message($_[0], 'a digester, hashref, or string') },
inflate => 0,
--
1.8.1.1