diff options
-rw-r--r-- | Makefile.PL | 2 | ||||
-rw-r--r-- | lib/Reaction/Class.pm | 1 | ||||
-rw-r--r-- | lib/Reaction/UI/Controller.pm | 17 | ||||
-rw-r--r-- | lib/Reaction/UI/Controller/Collection.pm | 6 | ||||
-rw-r--r-- | lib/Reaction/UI/Controller/Root.pm | 20 |
5 files changed, 26 insertions, 20 deletions
diff --git a/Makefile.PL b/Makefile.PL index aeb316b..2cab1d2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,7 +9,7 @@ requires 'Catalyst::Plugin::Static::Simple' => 0; requires 'Catalyst::Plugin::I18N' => 0; requires 'Catalyst::Model::DBIC::Schema' => 0; requires 'Catalyst::View::TT' => '0.23'; -requires 'Catalyst::Controller::BindLex' => 0; +requires 'Catalyst::Component::ACCEPT_CONTEXT' => 0; requires 'Config::General' => 0; requires 'Test::Class' => 0; requires 'Test::Memory::Cycle' => 0; diff --git a/lib/Reaction/Class.pm b/lib/Reaction/Class.pm index 549ee15..fcaf0a5 100644 --- a/lib/Reaction/Class.pm +++ b/lib/Reaction/Class.pm @@ -9,6 +9,7 @@ use Reaction::Object; sub exporter_for_package { my ($self, $package) = @_; my %exports_proto = $self->exports_for_package($package); + no warnings 'uninitialized'; # XXX fix this my %exports = ( map { my $cr = $exports_proto{$_}; ($_, sub { Sub::Name::subname "${self}::$_" => $cr; }) } keys %exports_proto diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index e0e1423..fa9290f 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -1,14 +1,19 @@ package Reaction::UI::Controller; -use base qw/Catalyst::Controller::BindLex Reaction::Object/; +use base qw( + Catalyst::Controller + Catalyst::Component::ACCEPT_CONTEXT + Reaction::Object +); + use Reaction::Class; sub push_viewport { my $self = shift; - my $focus_stack :Stashed; + my $c = $self->context; + my $focus_stack = $c->stash->{focus_stack}; my ($class, @proto_args) = @_; my %args; - my $c = Catalyst::Controller::BindLex::_get_c_obj(4); if (my $vp_attr = $c->stack->[-1]->attributes->{ViewPort}) { if (ref($vp_attr) eq 'ARRAY') { $vp_attr = $vp_attr->[0]; @@ -35,14 +40,12 @@ sub push_viewport { } sub pop_viewport { - my $focus_stack :Stashed; - return $focus_stack->pop_viewport; + return shift->context->stash->{focus_stack}->pop_viewport; } sub pop_viewports_to { my ($self, $vp) = @_; - my $focus_stack :Stashed; - return $focus_stack->pop_viewports_to($vp); + return $self->context->stash->{focus_stack}->pop_viewports_to($vp); } sub redirect_to { diff --git a/lib/Reaction/UI/Controller/Collection.pm b/lib/Reaction/UI/Controller/Collection.pm index d7d727b..75ceef8 100644 --- a/lib/Reaction/UI/Controller/Collection.pm +++ b/lib/Reaction/UI/Controller/Collection.pm @@ -45,14 +45,14 @@ sub list :Chained('base') :PathPart('') :Args(0) { sub object :Chained('base') :PathPart('id') :CaptureArgs(1) { my ($self, $c, $key) = @_; - my $object :Stashed = $self->get_collection($c)->find($key); + my $object = $self->get_collection($c)->find($key); confess "Object? what object?" unless $object; # should be a 404. + $c->stash(object => $object); } sub view :Chained('object') :Args(0) { my ($self, $c) = @_; - my $object :Stashed; - $c->forward(basic_page => [{object => $object}]); + $c->forward(basic_page => [{object => $c->stash->{object}}]); } sub basic_page : Private { diff --git a/lib/Reaction/UI/Controller/Root.pm b/lib/Reaction/UI/Controller/Root.pm index a5a8279..75273fb 100644 --- a/lib/Reaction/UI/Controller/Root.pm +++ b/lib/Reaction/UI/Controller/Root.pm @@ -15,18 +15,20 @@ has 'window_title' => (isa => 'Str', is => 'rw'); sub begin :Private { my ($self, $ctx) = @_; - my $window :Stashed = Reaction::UI::Window->new( - ctx => $ctx, - view_name => $self->view_name, - content_type => $self->content_type, - title => $self->window_title, - ); - my $focus_stack :Stashed = $window->focus_stack; + $ctx->stash( + window => Reaction::UI::Window->new( + ctx => $ctx, + view_name => $self->view_name, + content_type => $self->content_type, + title => $self->window_title, + ) + ); + $ctx->stash(focus_stack => $ctx->stash->{window}->focus_stack); } sub end :Private { - my $window :Stashed; - $window->flush; + my ($self, $ctx) = @_; + $ctx->stash->{window}->flush; } 1; |