サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
デスク環境を整える
advent.plackperl.org
We've been talking about adapting existing web frameworks to PSGI and writing a new application using PSGI as an interface, but we haven't talked about error handling. Handling errors We have an awesome stack trace middleware enabled by default, so if an end user application throws an error, we can catch them and display a nice error page. But what if there is an error or a bug in one of middlewar
These days laptops with modern operation systems allows you to quickly develop a web application and test it locally with its local IP address. Often you want to test your application with a global access, to show off your work to friends who don't have an access to your local network, or you're writing a web application that works as a webhooks callback. Reverse HTTP to the rescue There are many
Conditional middleware and URLMap app have something in common: they're PSGI applications but both takes PSGI application or middleware and dispatch them. This is the beauty of PSGI application and middleware architecture and today's application is another example of this. Cascading multiple applications Cascading can be useful if you have a couple of applications and runs in order, then try until
Today we'll see another very simple but useful example of a middleware component, this time to add functionality beyond just basic HTTP functions. JSONP JSONP (JSON-Padding) is a technology to wrap JSON in a JavaScript callback function. This is normally useful when you want to allow your JSON-based content included programatically in the third party websites using HTML script tags. Middleware::JS
Testing There are many ways to test web applications, either with a live server or using a mock request technique. Some web application frameworks allow you to write an unit test using one of those methods, but the way you write tests differ per framework of your choice. Plack::Test gives you an unified interface to test any web applications and frameworks that is compatible to PSGI using both moc
Hello World! but anyone else? Throughout the advent calendar we most of the time use the simplest web application using the "Hello World" example, like my $app = sub { return [ 200, [], [ "Hello World" ] ]; }; what about more complex examples, like you have multiple applications, each of which inherit from one of the web application frameworks, and use one of apache magic like mod_alias etc. Plack
For the couple of days we've been talking about how to convert existing CGI based applications to PSGI, and then run them as a PSGI application. Today we'd show you the ultimate way to run any CGI scripts as a PSGI application, most of the time unmodified. CGI::PSGI is a subclass of CGI.pm to allow you a very easy migration from CGI.pm with only a few lines of code changes to run it on PSGI enviro
Plack distribution comes with some readymade PSGI applications in Plack::App namespace. Some of them might be pretty handy, and one example for that would be Plack::App::File and Plack::App::Directory. Plack::App::File is to translate the request path, like /foo/bar.html into the local file, like /path/to/htdocs/foo/bar.html and opens the file handle and passes it back as a PSGI response. So that'
The first program you write with any of the programming language is the one that prints "Hello World". Let's follow the tradition for PSGI as well. Note: today's code is written in a raw PSGI interface to understand what's going on, but in reality you should never have to do this unless you're a web application framework developer. Otherwise you should use one of existing frameworks that supports
The most important step to get started is to install Plack and other utilities. Because PSGI and Plack are just like normal Perl module distributions, the installation is as easy: just launch your CPAN shell and type cpan> install PSGI Plack PSGI is a specification document for PSGI interface, so by installing the distribution you can read the documents on your shell with perldoc PSGI or perldoc P
The content of this blog has been updated, and now is available as an e-book called Plack Handbook. The e-book includes Japanese translation as well, and the source code of this book is available for free. 24 days have passed so fast and this is the last entry for this Plack advent calendar. Best Practices Plack and PSGI are still really young projects but we've already discovered a couple of sugg
このページを最初にブックマークしてみませんか?
『Plack Advent Calendar』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く