]> git.vpit.fr Git - perl/modules/LaTeX-TikZ.git/commitdiff
Fix the autocoercing code with recent versions of Moose
authorVincent Pit <vince@profvince.com>
Tue, 6 Aug 2013 18:34:25 +0000 (15:34 -0300)
committerVincent Pit <vince@profvince.com>
Tue, 6 Aug 2013 18:34:25 +0000 (15:34 -0300)
With Moose, it is no longer possible to have a coercing attribute in an
immutable class be updated with coercions loaded "late". These
semantics are actually quite understandable, but on the other hand there's
no easy way to recover which attributes coerce to a given type coercion,
which would allow us to manually force the recompilation of the coercing
code for the attributes. Thus we have to make the classes that contain
such an attribute mutable when Moose is in use.

lib/LaTeX/TikZ/Formatter.pm
lib/LaTeX/TikZ/Meta/TypeConstraint/Autocoerce.pm
lib/LaTeX/TikZ/Set/Point.pm
t/02-autocoerce.t

index afdbd388c93d3aa8f36f74b3342c581be61dacc1..e5bb3cf6cd724775f0218390d3e166de90de5b27 100644 (file)
@@ -361,7 +361,7 @@ LaTeX::TikZ::Interface->register(
  },
 );
 
  },
 );
 
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
 
 =head1 SEE ALSO
 
 
 =head1 SEE ALSO
 
index 0356cb0a29a13da9dbf80ae2415a5bba93194512..7671ade74ddbca7fb9538992ac72bb45ed295e75 100644 (file)
@@ -47,7 +47,9 @@ our $VERSION = '0.02';
       coerce  => 1,
       handles => [ 'id' ],
      );
       coerce  => 1,
       handles => [ 'id' ],
      );
-     __PACKAGE__->meta->make_immutable;
+     # This class shouldn't be immutable when using Moose, or the
+     # coercing attributes will not be updated with the future coercions.
+     __PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
     }
 
     # Another class the user wants to use instead of X (cannot be changed)
     }
 
     # Another class the user wants to use instead of X (cannot be changed)
index 4cf79921e16fe2d594059a52c69bf094379d3a86..6e78e66a69f6d2b542e2c4992992738491428063 100644 (file)
@@ -154,7 +154,7 @@ LaTeX::TikZ::Functor->default_rule(
  }
 );
 
  }
 );
 
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
 
 =head1 SEE ALSO
 
 
 =head1 SEE ALSO
 
index 86d49ccacf35b50540db56b795a88733b86696c2..cbfb6e39df1f675a222e77053fa59fbddac58843 100644 (file)
@@ -108,7 +108,7 @@ use LaTeX::TikZ::Meta::TypeConstraint::Autocoerce;
   coerce   => 1,
  );
 
   coerce   => 1,
  );
 
- __PACKAGE__->meta->make_immutable;
+ __PACKAGE__->meta->make_immutable if any_moose() ne 'Moose';
 
  sub main::Z () { __PACKAGE__ }
 }
 
  sub main::Z () { __PACKAGE__ }
 }