committing broken version. rolling back in a min. just making sure this gets saved...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Component.pm
index 52736f4..b5b56e2 100644 (file)
@@ -1,17 +1,27 @@
 package Catalyst::Component;
 
 use Moose;
-use MooseX::ClassAttribute;
+#use MooseX::ClassAttribute;
 use Catalyst::Utils;
+use Class::Data::Inheritable;
+use NEXT;
 
-has _config  => (
-                 is => 'rw',
-                 isa => 'HashRef',
-                 required => 1,
-                 default => {}
-                );
+{
+  my $mk_classdata =  Class::Data::Inheritable->can('mk_classdata');
+  __PACKAGE__->meta->add_method(mk_classdata => $mk_classdata);
+}
+
+__PACKAGE__->mk_classdata(_config => {});
+__PACKAGE__->mk_classdata('_plugins');
 
-class_has _plugins => ( is => 'rw' );
+# class_has _config  => (
+#                  is => 'rw',
+#                  isa => 'HashRef',
+#                  required => 1,
+#                  default => sub { {} }
+#                 );
+
+# class_has _plugins => ( is => 'rw' );
 
 
 =head1 NAME
@@ -66,9 +76,9 @@ around new => sub {
 
     # Temporary fix, some components does not pass context to constructor
     my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
-    my $merged = $self->merge_config_hashes( $self->config, $arguments ) );
+    my $merged = $self->merge_config_hashes( $self->config, $arguments );
     $orig->( $self, $merged );
-}
+};
 
 sub COMPONENT {
     my ( $self, $c ) = @_;
@@ -81,6 +91,7 @@ sub COMPONENT {
     if ( my $new = $self->NEXT::COMPONENT( $c, $arguments ) ) {
         return $new;
     }
+    #new here will always pass because $self ISA Moose::Object
     else {
         if ( my $new = $self->new( $c, $arguments ) ) {
             return $new;
@@ -89,6 +100,7 @@ sub COMPONENT {
             my $class = ref $self || $self;
             my $new   = $self->merge_config_hashes(
                 $self->config, $arguments );
+            #this will break, Moose::Object::new won't act like this
             return bless $new, $class;
         }
     }