Fix defualt -> default typos in perldoc
[catagits/Reaction.git] / lib / Reaction / UI / Controller.pm
index fc2f597..45a85d8 100644 (file)
@@ -1,13 +1,19 @@
 package Reaction::UI::Controller;
 
-use base qw(
-  Catalyst::Controller
-  Catalyst::Component::ACCEPT_CONTEXT
-  Reaction::Object
-);
+use base qw(Catalyst::Controller Reaction::Object);
 
 use Reaction::Class;
 use Scalar::Util 'weaken';
+use namespace::clean -except => [ qw(meta) ];
+
+has context => (is => 'ro', isa => 'Object', weak_ref => 1);
+with 'Catalyst::Component::InstancePerContext';
+
+sub build_per_context_instance {
+  my ($self, $c, @args) = @_;
+  my $newself =  $self->new($self->_application, {%$self, context => $c, @args});
+  return $newself;
+}
 
 sub push_viewport {
   my $self = shift;
@@ -77,7 +83,7 @@ sub redirect_to {
 sub make_context_closure {
   my($self, $closure) = @_;
   my $ctx = $self->context;
-  weaken $ctx;
+  weaken($ctx);
   return sub { $closure->($ctx, @_) };
 }