Revert "better check for if add_class_attribute is present."
[gitmo/MooseX-AlwaysCoerce.git] / lib / MooseX / AlwaysCoerce.pm
index e5ffeea..8cb3831 100644 (file)
@@ -18,11 +18,11 @@ MooseX::AlwaysCoerce - Automatically enable coercions for Moose attributes
 
 =head1 VERSION
 
-Version 0.12
+Version 0.16
 
 =cut
 
-our $VERSION = '0.13';
+our $VERSION = '0.16';
 
 =head1 SYNOPSIS
 
@@ -71,6 +71,9 @@ Use C<< coerce => 0 >> to disable a coercion explicitly.
     use Moose::Role;
     use Moose::Util::TypeConstraints;
 
+    # MooseX::ClassAttribute is not always present in the consuming class
+    sub add_class_attribute { }
+
     around add_class_attribute => sub {
         my $next = shift;
         my $self = shift;
@@ -95,8 +98,9 @@ my (undef, undef, $init_meta) = Moose::Exporter->build_import_methods(
     },
 
     role_metaroles => {
-        # applied_attribute should be available soon, for now roles are borked
-        # applied_attribute   => ['MooseX::AlwaysCoerce::Role::Meta::Attribute'],
+        (Moose->VERSION >= 1.9900
+            ? (applied_attribute => ['MooseX::AlwaysCoerce::Role::Meta::Attribute'])
+            : ()),
         role                => ['MooseX::AlwaysCoerce::Role::Meta::Class'],
     }
 );