added attribute metaclass support.
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index 7f2378d..b9179eb 100644 (file)
@@ -88,6 +88,14 @@ sub get_method_list {
     $get_methods_for_class->($self, $self->name);
 }
 
+sub get_all_method_names {
+    my $self = shift;
+    my %uniq;
+    return grep { $uniq{$_}++ == 0 }
+            map { $get_methods_for_class->(undef, $_) }
+            $self->linearized_isa;
+}
+
 sub add_attribute {
     my $self = shift;
     my $attr = shift;
@@ -165,6 +173,10 @@ sub make_immutable {
     if ($args{inline_destructor}) {
         $self->add_method('DESTROY' => Mouse::Meta::Method::Destructor->generate_destructor_method_inline( $self ));
     }
+
+    # Moose's make_immutable returns true allowing calling code to skip setting an explicit true value
+    # at the end of a source file. 
+    return 1;
 }
 
 sub make_mutable { confess "Mouse does not currently support 'make_mutable'" }
@@ -183,8 +195,7 @@ sub _install_modifier {
             $code
         );
     }
-    else {
-        require Class::Method::Modifiers;
+    elsif (eval "require Class::Method::Modifiers; 1") {
         Class::Method::Modifiers::_install_modifier( 
             $into,
             $type,
@@ -192,6 +203,9 @@ sub _install_modifier {
             $code
         );
     }
+    else {
+        Carp::croak("Method modifiers require the use of Class::Method::Modifiers. Please install it from CPAN and file a bug report with this application.");
+    }
 }
 
 sub add_before_method_modifier {