Created
August 14, 2012 05:56
-
-
Save anazawa/3346759 to your computer and use it in GitHub Desktop.
as_arrayref
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # as_arrayref | |
| package as_arrayref; | |
| use strict; | |
| use warnings; | |
| use Blosxom::Header; | |
| sub start { !$blosxom::static_entries } | |
| sub last { | |
| my $header = Blosxom::Header->instance: | |
| return [ | |
| $header->status, | |
| [ $header->flatten ], | |
| [ $blosxom::output ], | |
| ]; | |
| } | |
| package blosxom; | |
| sub as_arrayref { as_arrayref->last } | |
| 1; | |
| # blosxom.psgi | |
| my $app = sub { | |
| my $env = shift; | |
| local %ENV = ( %ENV, %$env ); | |
| do 'blosxom.cgi'; | |
| blosxom->as_arrayref; | |
| }; | |
| # PURPOSE | |
| CGI::Parse::PSGI を使わずに PSGI 互換の coderef を返す。 | |
| # HOW | |
| coderef が返す arrayref を as_arrayref プラグインが生成する。 | |
| # TODO | |
| - print STDOUT | |
| - CGI::initialize_globals | |
| - do 文だと何度も実行できない? (->Shotgun?) | |
| - Blosxom::Header は Expires ヘッダと Set-Cookie ヘッダを展開しない | |
| - $header->flatten は Status ヘッダを含む | |
| # DISCUSSION | |
| Blosxom::Header を使わずに、 | |
| my @headers = split "$CGI::CRLF", CGI::header( $blosxom::header ); | |
| としても同じこと。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment