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.

Created: 2013-02-19T01:03:12Z
Updated: 2013-02-19T01:03:12Z
comments powered by Disqus