tokuhirom's Blog

Try::Lite is especially useful in PSGI handler.

I guess, Try::Lite is very useful in PSGI handler.

use Try::Lite;

my $app = sub {
  try {
    main_handler();
  }
    "MyApp::Exception::PermissionDenied" => sub {
      [403, ['Content-Type' => 'text/plain'], ['Forbidden']]
    },
    "MyApp::Exception::NotFound" => sub {
      [404, ['Content-Type' => 'text/plain'], ['Not Found']]
    },
};

Awesome.