NAME
Foorum::Controller::Get
DESCRIPTION
Usually we write something like follows:
my $user = $c->model('DBIC::User')->get( { username => $username } );
$c->detach( '/print_error', ['ERROR_USER_NON_EXSIT'] ) unless ($user);
if ( $user->{status} eq 'banned' or $user->{status} eq 'blocked' ) {
$c->detach( '/print_error', ['ERROR_ACCOUNT_CLOSED_STATUS'] );
}
It's pretty trival to write it everywhere, and we can't put '/print_error' into Model/User.pm since we do not need to raise error every time. so I put it into Controller/Get.pm
so does forum, topic.
AUTHOR
Fayland Lam <fayland at gmail.com>