diff --git a/lib/PostText/Controller/Remark.pm b/lib/PostText/Controller/Remark.pm index ab7c1fa..8441949 100644 --- a/lib/PostText/Controller/Remark.pm +++ b/lib/PostText/Controller/Remark.pm @@ -19,16 +19,18 @@ sub create($self) { $v = $self->validation if $self->req->method eq 'POST'; if ($v && $v->has_data) { - my $remark_author = $self->param('author'); - my $remark_body = $self->param('body' ); + my ($remark_author, $remark_body); - $v->required('author')->size(1, 63 ); + $v->required('author')->size(1, 63); $v->required('body' )->size(2, 4000); if ($v->has_error) { $self->stash(status => 400) } else { + $remark_author = $v->param('author'); + $remark_body = $v->param('body' ); + $self->remark->create( $thread_id, $remark_author, diff --git a/lib/PostText/Controller/Thread.pm b/lib/PostText/Controller/Thread.pm index 0ba3a70..0c57d74 100644 --- a/lib/PostText/Controller/Thread.pm +++ b/lib/PostText/Controller/Thread.pm @@ -8,18 +8,20 @@ sub create($self) { $v = $self->validation if $self->req->method eq 'POST'; if ($v && $v->has_data) { - my $thread_author = $self->param('author'); - my $thread_title = $self->param('title' ); - my $thread_body = $self->param('body' ); + my ($thread_author, $thread_title, $thread_body); - $v->required('author')->size(1, 63 ); - $v->required('title' )->size(1, 127 ); + $v->required('author')->size(1, 63); + $v->required('title' )->size(1, 127); $v->required('body' )->size(2, 4000); if ($v->has_error) { $self->stash(status => 400) } else { + $thread_author = $v->param('author'); + $thread_title = $v->param('title' ); + $thread_body = $v->param('body' ); + my $new_thread_id = $self->thread->create( $thread_author, $thread_title,