Subject: | Compilation failing because of invalid characters in type declarations |
Compilation or installation via CPAN of this module is failing with
errors like the following:
# Error: Chart-OFC2-Title contains invalid characters for a type
name.Names can contain alphanumeric character, ":", and "."
# Compilation failed in require at
/home/rwebster/Desktop/Chart-OFC2-0.02/blib/lib/Chart/OFC2.pm line 69.
# BEGIN failed--compilation aborted at
/home/rwebster/Desktop/Chart-OFC2-0.02/blib/lib/Chart/OFC2.pm line 69.
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
This problem occurs on systems with the latest version of Moose and
Moose::Util::TypeConstraints.
This is because a number of files in this module have type declarations
where the name contains a dash ('-'). For example:
Chart-OFC2-Labels
Chart-OFC2-XAxis
Chart-OFC2-YAxis
Chart-OFC2-Extremes
Chart-OFC2-Title
* These are in sub-modules such as 'Chart::OFC2::Labels'.
Chart::OFC2 uses the Perl modules Moose and
Moose::Util::TypeConstraints. However, sometime in the past year a
restriction was added to Moose::Util::TypeConstraints to only allow
alphanumerics, ":", and "." in names. I believe this to be the relevant
change:
-------------------------
0.66 Tue, February 3, 2009
* Moose::Util::TypeConstraints
- You could declare a name with subtype such as "Foo!Bar" that
would be allowed, but if you used it in a parameterized type
such as "ArrayRef[Foo!Bar]" it wouldn't work. We now do some
vetting on names created via the sugar functions, so that they
can only contain alphanumerics, ":", and ".". (Dave Rolsky)
-------------------------
* From following change log:
http://cpansearch.perl.org/src/DROLSKY/Moose-0.72/Changes
The simple solution is to change all such names to use a period ('.')
instead of a dash ('-').
I have done this manually with and confirmed that the modified source
code compiles and installs without error.