diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-11 20:45:53 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-11 20:45:53 +0000 |
commit | 7ea45b2aff36dd61953b1517a1cfb079dcea230c (patch) | |
tree | ed3d9088117b280d129d887f75283be6536c5838 /lib/Reaction/UI/Controller | |
parent | 0209ee1b140549013842f9534b2d9d8b79d1e152 (diff) | |
download | reaction-7ea45b2aff36dd61953b1517a1cfb079dcea230c.tar.gz reaction-7ea45b2aff36dd61953b1517a1cfb079dcea230c.zip |
memory leaks on CRUD fixed
Diffstat (limited to 'lib/Reaction/UI/Controller')
-rw-r--r-- | lib/Reaction/UI/Controller/Collection/CRUD.pm | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Reaction/UI/Controller/Collection/CRUD.pm b/lib/Reaction/UI/Controller/Collection/CRUD.pm index 1813e05..1d8e4cc 100644 --- a/lib/Reaction/UI/Controller/Collection/CRUD.pm +++ b/lib/Reaction/UI/Controller/Collection/CRUD.pm @@ -38,8 +38,8 @@ sub get_model_action { sub create :Chained('base') :PathPart('create') :Args(0) { my ($self, $c) = @_; my $vp_args = { - on_apply_callback => sub { $self->after_create_callback($c => @_); }, - on_close_callback => sub { $self->on_create_close_callback($c => @_) } + on_apply_callback => sub { $self->after_create_callback( @_); }, + on_close_callback => sub { $self->on_create_close_callback( @_) } }; $self->basic_model_action( $c, $vp_args); } @@ -47,38 +47,40 @@ sub create :Chained('base') :PathPart('create') :Args(0) { sub delete_all :Chained('base') :PathPart('delete_all') :Args(0) { my ($self, $c) = @_; $self->basic_model_action( $c, { - on_close_callback => sub { $self->on_delete_all_close_callback($c => @_) } + on_close_callback => sub { $self->on_delete_all_close_callback( @_) } }); } sub on_delete_all_close_callback { - my($self, $c) = @_; - $self->redirect_to($c, 'list'); + my($self) = @_; + $self->redirect_to($self->context, 'list'); } sub after_create_callback { - my ($self, $c, $vp, $result) = @_; + my ($self, $vp, $result) = @_; + my $c = $self->context; return $self->redirect_to ( $c, 'update', [ @{$c->req->captures}, $result->id ] ); } sub on_create_close_callback { my($self, $c, $vp) = @_; - $self->redirect_to( $c, 'list' ); + $self->redirect_to( $self->context, 'list' ); } sub update :Chained('object') :Args(0) { my ($self, $c) = @_; my $vp_args = { - on_close_callback => sub { $self->on_update_close_callback($c => @_ ) } + on_close_callback => sub { $self->on_update_close_callback( @_ ) } }; $self->basic_model_action( $c, $vp_args); } sub on_update_close_callback { - my($self, $c) = @_; + my($self) = @_; #this needs a better solution. currently thinking about it - my @cap = @{$c->req->captures}; + my $c = $self->context; + my @cap = @{ $c->req->captures }; pop(@cap); # object id $self->redirect_to($c, 'list', \@cap); } @@ -86,7 +88,7 @@ sub on_update_close_callback { sub delete :Chained('object') :Args(0) { my ($self, $c) = @_; my $vp_args = { - on_close_callback => sub { $self->on_update_close_callback($c => @_) } + on_close_callback => sub { $self->on_update_close_callback( @_) } }; $self->basic_model_action( $c, $vp_args); } |