handle non-Component children
Matt S Trout [Sat, 8 Jan 2011 14:07:00 +0000 (14:07 +0000)]
lib/App/Clifton/Component.pm

index e6d592c..7b153f0 100644 (file)
@@ -26,7 +26,13 @@ sub BUILD {
 
 sub _new_child {
   my ($self, $class, $args) = @_;
-  $class->new(%{$args||{}}, parent_component => $self);
+  if ($class->isa('App::Clifton::Component')) {
+    $class->new(%{$args||{}}, parent_component => $self);
+  } else {
+    my $new = $class->new(%{$args||{}});
+    $self->add_child($new);
+    $new;
+  }
 }
 
 sub _schedule {