Friday, October 23, 2009

PSGI and Plack

The most exciting thing in Perl world today is PSGI

The homepage is http://plackperl.org/

I tried that today. there are some tips for Win32 user.
* Don't try to run under Standalone server, the alarm is not supported in Win32
* after install Plack (maybe notest install Plack), try install Plack::Server::AnyEvent or Plack::Server::ServerSimple
* at last, to know a bit of the Plack, cd the cpan build dir or download the tar.gz
C:\strawberry\cpan\build\Plack-0.9006-ZEaDbK\eg\dot-psgi>plackup -a Hello.psgi -s AnyEvent
Accepting requests at http://0.0.0.0:5000/
OR
C:\strawberry\cpan\build\Plack-0.9006-ZEaDbK\eg\dot-psgi>plackup -a Hello.psgi -s ServerSimple
Plack::Server::ServerSimple: You can connect to your server at http://localhost:5000/
127.0.0.1 - - [23/十月/2009 22:19:15] "GET / HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 GTB5"
127.0.0.1 - - [23/十月/2009 22:19:15] "GET /favicon.ico HTTP/1.1" 200 11 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 GTB5"
try visit http://127.0.0.1:5000/ then you'll get the access_log like above.

well, I think the Plack::Middleware::AccessLog should use &POSIX::setlocale(&POSIX::LC_ALL); on qw( .ISO8859-1 .ISO_8859-15 .US-ASCII .UTF-8 ) to avoid 十月 the Chinese.

you can try more with the all the .psgi files under eg/dot-psgi, and you might have some ideas to write a Middleware. :)

Thanks

(Updates on Oct 24th)
miyagawa applied the patch with some changes and it works pretty well now.
Thanks very much. :)

Labels: