Created
July 8, 2012 02:19
-
-
Save anazawa/3069023 to your computer and use it in GitHub Desktop.
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
| - Blosxom はとにかく沢山の変数をグローバル化する。 | |
| 昨今の WAF を見習って、変数を response や request といった適切な名前空間に割り当てる。 | |
| 例えば $path_info は request に所属する、と考える。 | |
| $blosxom::なんちゃらという書き方にも飽きた。 | |
| - おそらく CGI::Application は Blosxom と密接な関係にある。 | |
| ただし Blosxom は WAF ではない (と思う) 。 | |
| あくまで手続き型の書き方が性に合ってるんじゃないか。 | |
| - Blosxom の本体に手を入れる気はまったくない。(development team ががんばってくれるはず) | |
| あくまで、blosxom.cgi に寄り添った形でクラスを書く。 | |
| WAF のような書き方もできるという立場で、CPAN の名前空間を開拓する。 | |
| vi に対する、vim みたいな感じ? 違うか。 | |
| - blosxom.cgi は CGI.pm を読み込んでいる。CGI モジュールは CGI::Util に依存していて、 | |
| expires() という関数を import している。この関数は HTTP::Date の time2str() としても働く。 | |
| 当然、プラグインも CGI::Util::expires を使うことができる。 | |
| - Singleton クラスは実質的にグローバル変数だ、という話を聞いた。 | |
| 「blosxom のグローバル変数」=> Singleton クラス、と考えるのはやりすぎか。 | |
| - そういえば Blosxom 2.1.2 で @INC を操作している部分がある。 | |
| ここは、@INC を localize すべきなんじゃないか。 | |
| でもどうパッチを書いていいか分からない。 |
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
| package Blosxom::Plugin; | |
| use strict; | |
| use warnings; | |
| sub config {} | |
| sub response { | |
| require Blosxom::Header: | |
| Blosxom::Header->instance; | |
| } | |
| sub request { | |
| require Blosxom::Response; | |
| Blosxom::Request->instance; | |
| } | |
| *res = ¥&response; | |
| *req = ¥&request; | |
| 1; | |
| package Blosxom::Request; # not implemented yet | |
| use strict; | |
| use warnings; | |
| use base 'Class::Singleton'; | |
| sub method {} | |
| sub if_modified_since {} | |
| sub cookie {} | |
| 1; | |
| package foo; | |
| use strict; | |
| use warnings; | |
| use base 'Blosxom::Plugin'; | |
| sub start { !shift->config->{static_entries} } | |
| sub last { | |
| my $class = shift; # Class method | |
| $class->response->status( 304 ); | |
| } | |
| 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment