Dancer2-Plugin-LogReport

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/LogReport.pod  view on Meta::CPAN

can be messy code. An alternative is to use exceptions, but these
can be a pain to deal with in terms of catching them.
Here's how to do it with L<Log::Report|Log::Report>.

In this example, we do use exceptions, but in a neat, easier to use manner.

First, your module/model:

  package MyApp::CD;

  sub update {
    my ($self, %values) = @_;
    $values{title} or error "Please enter a title";
    $values{description} or warning "No description entered";
  }

Then, in your controller:

  package MyApp;
  use Dancer2;



( run in 0.312 second using v1.01-cache-2.11-cpan-da0455809f2 )