Skip to content

yusukebe/Rumi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rumi - yet another girl.

Rumi is lightweight web application framework for me.

Example

myapp.psgi

use lib "./lib";
use MyApp::Web;
use Plack::Builder;

my $web = MyApp::Web->new;
my $app = $web->to_app();

builder {
    enable "Plack::Middleware::Static",
      path => qr{^/(favicon\.ico|images/|js/|css/)},
      root => './htdocs/';
    enable_if { $_[0]->{REMOTE_ADDR} eq '127.0.0.1' }
    "Plack::Middleware::ReverseProxy";
    enable "Plack::Middleware::AccessLog", format => "combined";
    $app;
};

MyApp/Web.pm

package MyApp::Web;
use strict;
use warnings;

use parent qw/Rumi::Web/;
use Text::Xslate;
sub install_view {
    my $view = Text::Xslate->new(
        path => ['./tmpl'],
        header => ['header.tt2'],
        footer => ['footer.tt2'],
        syntax => 'TTerse',
    );
    return { default => $view };
}

1;

MyApp/Web/Dispatcher.pm

package MyApp::Web::Dispatcher;
use strict;
use warnings;

use Rumi::Web::Dispatcher;
connect '/' => { controller => 'Root', action => 'index' };

1;

MyApp/Web/Controller/Root.pm

package MyApp::Web::Controller::Root;
use strict;
use warnings;

sub index {
    my ( $self, $c ) = @_;
    return 'index.tt2', {};
}

1;

Core required modules.

  • Plack::Request
  • Router::Simple
  • (Text::Xslate)

TODO

  • Writing tests
  • Setup script
  • Session

AUTHOR

About

Yet Anothor Girl, just web application framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages