From: André Walker Date: Wed, 10 Aug 2011 03:55:39 +0000 (-0300) Subject: ditching the COMPONENT constructor X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df0d84419ff21493fe7afd477f0201ce5590fdf1;hp=2c77a89427930786f5dd14924e66764e7e7f3016;p=catagits%2FCatalyst-Runtime.git ditching the COMPONENT constructor --- diff --git a/t/lib/TestAppCustomContainer/Model/Bar.pm b/t/lib/TestAppCustomContainer/Model/Bar.pm index 86dcfd2..1c92392 100644 --- a/t/lib/TestAppCustomContainer/Model/Bar.pm +++ b/t/lib/TestAppCustomContainer/Model/Bar.pm @@ -4,6 +4,12 @@ extends 'Catalyst::Model'; with 'TestAppCustomContainer::Role::HoldsFoo', 'TestAppCustomContainer::Role::ACCEPT_CONTEXT'; +sub BUILD { + my ( $self ) = @_; + + $self->foo->inc_bar_got_it; +} + __PACKAGE__->meta->make_immutable; no Moose; diff --git a/t/lib/TestAppCustomContainer/Model/Baz.pm b/t/lib/TestAppCustomContainer/Model/Baz.pm index 2efb1f5..fa475e6 100644 --- a/t/lib/TestAppCustomContainer/Model/Baz.pm +++ b/t/lib/TestAppCustomContainer/Model/Baz.pm @@ -4,6 +4,12 @@ extends 'Catalyst::Model'; with 'TestAppCustomContainer::Role::HoldsFoo', 'TestAppCustomContainer::Role::ACCEPT_CONTEXT'; +sub BUILD { + my ( $self ) = @_; + + $self->foo->inc_baz_got_it; +} + __PACKAGE__->meta->make_immutable; no Moose; diff --git a/t/lib/TestAppCustomContainer/Role/HoldsFoo.pm b/t/lib/TestAppCustomContainer/Role/HoldsFoo.pm index a51f948..9e0aeba 100644 --- a/t/lib/TestAppCustomContainer/Role/HoldsFoo.pm +++ b/t/lib/TestAppCustomContainer/Role/HoldsFoo.pm @@ -8,13 +8,4 @@ has foo => ( required => 1, ); -sub COMPONENT { - my ( $self, $ctx, $config ) = @_; - - # FIXME - is this how should I get model Foo? - return $self->new( - foo => $ctx->model('Foo'), - ); -} - 1;