tokuhirom
4/22/2014 - 10:01 AM

gistfile1.txt

sub Member::get_ad($self, $id) {
  my $ad = $self->db->find->ad($id) or throw NotFoundException->throw;
  if ($ad->member_id eq $self->id) {
    return $ad;
  } else {
    return SecurityException->throw(); # ここはもう
  }
}

sub Controller::dispatch_update_ad($c) {
  my $ad = $c->member->get_ad($id);
  ...
}