Handwritten Router
file: code/HandwrittenPSGIRouter 16: my $app = sub { 17: my $env = shift; 18: my $req = Plack::Request->new($env); 19: 20: my $path = $req->path_info; 21: 22: try { 23: my $action = $poor_persons_routes{$path}; 24: if ($action) { 25: my $res = $action->($req); 26: return $res->finalize; 27: } 28: else { 29: return Plack::Response->new(404)->finalize; 30: } 31: }
If we find an entry, call the subref and return the response