NAME
Terse::App - Lightweight MVC applications.
VERSION
Version 0.18
SYNOPSIS
.. My/App.pm
package My::App;
use base 'Terse::App';
sub login :any {
return 1;
}
sub auth_prevent :any(auth) {
return 0;
}
sub auth :get :post {
return 1;
}
... My/App/Controller/Hello.pm
package My::App::Controller::Hello;
use base 'Terse::Controller';
sub hello :get {
... #1
}
sub world :get {
... #2
}
... My/App/Controller/Hello/World.pm
package My::App::Controller::Hello::World;
use base 'Terse::Controller';
sub build_controller {
$_[0]->required_captured = 2;
$_[0]->capture = 'hello/(.*)/world/(.*)';
$_[0];
}
sub world :get {
$_[1]->respone->captured = $_[1]->captured;
... #3
}
.... MyApp.psgi ...
use Terse;
use My::App;
our $app = My::App->start();
sub {
my ($env) = (shift);
Terse->run(
plack_env => $env,
application => $app,
);
};
....
plackup MyApp.psgi
GET http://localhost:5000/hello?id=here&other=params #1
GET http://localhost:5000/hello?req=world #2
GET http://localhost:5000/hello/abc/world/123 #3
AUTHOR
LNATION, <email at lnation.org>