Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple WAF on PSGI

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 example View::JSON December 21, 2009
Octocat-spinner-32 lib
Octocat-spinner-32 sketch
Octocat-spinner-32 t
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Makefile.PL
Octocat-spinner-32 README.md
README.md

Cirdan

Chord の弱ぱくりです

Synopsis

use Cirdan; # Exports routing functions, response functions

routes {
    POST q'/entry'       => *post_entry; # Specify path as string, handler as typeglob
    GET  q'/entry/(\d+)' => *entry;
    ANY  q'/'            => *index;
    ANY  qr//            => sub { NOT_FOUND }; # Specify path as regexp, handler as coderef
};

sub post_entry {
    ...
    return BAD_REQUEST unless ...
    ...
    redirect +Cirdan->router->path_for('index');
}

use Cirdan::View qw(mt); # Exports renderer functions

sub index {
    my $body = mt *DATA, @args;
    return $body;
    # or
    # HTTP status code names are response maker
    # such as CREATED([\@headers,] $content)
    return OK $body;
    return OK [ 'Content-Type' => 'text/xml' ], $body;
}

# Finally...
__PSGI__ # returns PSGI handler

__END__
Something went wrong with that request. Please try again.