use UNIVERSAL::require; use Plack::Request; my $app = sub { local $_; $_->{'env'} = shift; $_->{'req'} = Plack::Request->new($_->{'env'}); $_->{'qd'} = $_->{'req'}->parameters->mixed; $_->{'qd'}->{'action'} ||= 'default'; $_->{'qd'}->{'action'} =~ s/\//\:\:/gs; $_->{'qd'}->{'action'} = "actions::$_->{'qd'}->{'action'}"; if ($_->{'qd'}->{'action'}->use()) { return [ 200, ['Content-Type' => 'text/html'], [$_->{'qd'}->{'action'}->render()] ]; } else { return [ 404, [ 'Content-Type' => 'text/plain' ], [ 'Error cannot find requested page'] ]; } };