merging in the lats of my two branches and killing them off
[catagits/Reaction.git] / lib / Reaction / UI / View.pm
index 4c7e8ef..1f7c00c 100644 (file)
@@ -19,6 +19,16 @@ class View which {
 
   has 'rendering_context_class' => (is => 'ro', lazy_build => 1);
 
+  implements '_build_layout_set_class' => as {
+    my ($self) = @_;
+    return $self->find_related_class('LayoutSet');
+  };
+
+  implements '_build_rendering_context_class' => as {
+    my ($self) = @_;
+    return $self->find_related_class('RenderingContext');
+  };
+
   implements 'COMPONENT' => as {
     my ($class, $app, $args) = @_;
     return $class->new(%{$args||{}}, app => $app);
@@ -69,6 +79,8 @@ class View which {
     my @search_path = ($base, $app_name, 'Reaction::UI');
     my @haystack    = map { join '::', $_, 'Widget', $tail } @search_path;
     for my $class (@haystack){
+      #here we should throw if exits and error instead of eating the error
+      #only next when !exists
       eval { Class::MOP::load_class($class) };
       #$@ ? next : return  $class;
       $@ ? next : return $cache->{ $lset_name } = $class;
@@ -116,11 +128,6 @@ class View which {
     confess "Unable to find related ${rel} class for ${own_class}";
   };
 
-  implements 'build_layout_set_class' => as {
-    my ($self) = @_;
-    return $self->find_related_class('LayoutSet');
-  };
-
   implements 'layout_set_args_for' => as {
     my ($self, $name) = @_;
     return (name => $name, search_path => $self->layout_search_path);
@@ -144,11 +151,6 @@ class View which {
            );
   };
 
-  implements 'build_rendering_context_class' => as {
-    my ($self) = @_;
-    return $self->find_related_class('RenderingContext');
-  };
-
   implements 'rendering_context_args_for' => as {
     return ();
   };