From: Matt S Trout Date: Sat, 8 Jan 2011 14:07:00 +0000 (+0000) Subject: handle non-Component children X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8b2081ac221fa947e07976edcee71141befd009b;p=scpubgit%2FClifton.git handle non-Component children --- diff --git a/lib/App/Clifton/Component.pm b/lib/App/Clifton/Component.pm index e6d592c..7b153f0 100644 --- a/lib/App/Clifton/Component.pm +++ b/lib/App/Clifton/Component.pm @@ -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 {