Permalink
Browse files

newlines

  • Loading branch information...
1 parent 7af18f0 commit 706c2f51419725ec1d7a6181c7fa1060fcedc61d @miyagawa committed Sep 11, 2012
View
@@ -50,4 +50,4 @@ Want to display something not text by reading a file? Do this.
}
};
-This app would serve favicon.ico if the request path looks like /favicon.ico, the "Hello World" page with requests to the root (/) and otherwise 404. You can see that a perl filehandle ($fh) is a valid PSGI response, and you can use whatever valid HTTP status code to return something different.
+This app would serve favicon.ico if the request path looks like /favicon.ico, the "Hello World" page with requests to the root (/) and otherwise 404. You can see that a perl filehandle ($fh) is a valid PSGI response, and you can use whatever valid HTTP status code to return something different.
View
@@ -33,4 +33,4 @@ or specify the unix domain socket the FCGI backend would listen:
> plackup -s FCGI --listen /tmp/fcgi.sock app.psgi
-For more options for plackup, run perldoc plackup from the command line. You'll see more plackup options and hacks tomorrow as well.
+For more options for plackup, run perldoc plackup from the command line. You'll see more plackup options and hacks tomorrow as well.
@@ -38,4 +38,4 @@ For instance, if your application uses Moose and DBIx::Class, then you can say:
> plackup -MMoose -MDBIx::Class -L Shotgun myapp.psgi
-would speed up the time required to compile your application in the runtime.
+would speed up the time required to compile your application in the runtime.
@@ -27,4 +27,4 @@ This is a very simple CGI application, and converting this to PSGI is easy using
`psgi_header` is an utility method to work just like CGI's `header` method, and returns the status code and an array reference containing the list of HTTP headers.
-Tomorrow, I'll talk about how to convert existing web frameworks that uses CGI.pm, using CGI::PSGI.
+Tomorrow, I'll talk about how to convert existing web frameworks that uses CGI.pm, using CGI::PSGI.
@@ -22,4 +22,3 @@ and use [plackup](http://advent.plackperl.org/2009/12/day-3-using-plackup.html)
Similarly, most web frameworks that "supports" PSGI provides a plugin, engine or adapter to make the framework run on PSGI mode. For instance, [Catalyst](http://www.catalystframework.org/) has a Catalyst::Engine::* web server abstraction and [Catalyst::Engine::PSGI](http://search.cpan.org/perldoc?Catalyst::Engine::PSGI) is the engine to adapt Catalyst to run on PSGI.
The point is that with "PSGI support" from web frameworks, your application doesn't need to be modified, most of the times any single lines of code. And then by switching to PSGI you'll have lots of benefits like being able to use toolchain like plackup, Plack::Test and middleware which we'll discuss later in the future advent entries.
-
@@ -120,4 +120,4 @@ Similarly Catalyst uses Catalyst::Engine abstraction and [Catalyst::Engine::PSGI
## mod_perl centric frameworks
-Some frameworks are centered around mod_perl's API, in which case we can't take the approaches like we've seen here. Instead, you should probably start by mocking Apache::Request APIs using a fake/mock object. Patric Donelan, a WebGUI developer explains his approach to make mod_perl-like API in [his blog post](http://blog.patspam.com/2009/plack-roundup-at-sf-pm) that you might be interested in, and the [mock request class linked](http://github.com/pdonelan/webgui/blob/plebgui/lib/WebGUI/Session/Plack.pm) would be a good start.
+Some frameworks are centered around mod_perl's API, in which case we can't take the approaches like we've seen here. Instead, you should probably start by mocking Apache::Request APIs using a fake/mock object. Patric Donelan, a WebGUI developer explains his approach to make mod_perl-like API in [his blog post](http://blog.patspam.com/2009/plack-roundup-at-sf-pm) that you might be interested in, and the [mock request class linked](http://github.com/pdonelan/webgui/blob/plebgui/lib/WebGUI/Session/Plack.pm) would be a good start.
@@ -4,7 +4,7 @@
Middleware is a concept in PSGI (as always, stolen from Python's WSGI and Ruby's Rack) where we define components that plays the both side of a server and an application.
-![WSGI middleware onion](http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/_images/pylons_as_onion.png)
+![WSGI middleware onion](images/pylons_as_onion.png)
(Image courtesy of Pylons project for Python WSGI)
@@ -66,4 +66,3 @@ The beauty of Middleware is that it can wrap *any* PSGI application. It might no
};
This will enable the Basic authentication middleware to CGI::Application based application. You can do the same with [any other frameworks that supports PSGI](http://plackperl.org/#frameworks).
-
@@ -85,4 +85,4 @@ Of course you can use this URLMap and mount API to run multiple framework applic
mount "/baz" => $app3;
};
-And now you have three applications, each of which inherit from different web framework, running on the same server (via plackup or other Plack::Server::* implementations) mapped on different paths.
+And now you have three applications, each of which inherit from different web framework, running on the same server (via plackup or other Plack::Server::* implementations) mapped on different paths.
@@ -88,4 +88,3 @@ Once again, the beauty of PSGI and Plack is that everything written to run for t
done_testing;
You can of course do the same thing against any frameworks that supports PSGI.
-
View
@@ -33,4 +33,4 @@ Plack::Request is available as part of Plack on CPAN. Your framework can use Pla
Directly using Plack::Request in the `.psgi` code is quite handy to quickly write and test your code but not really recommended for a large scale application. It's exactly like writing a 1000 lines of `.cgi` script where you could factor out the application code into a module (`.pm` files). The same thing applies to `.psgi` file: it's best to create an application class by using and possibly extending Plack::Request, and then have just a few lines of code in `.psgi` file with [Plack::Builder to configure middleware components](http://advent.plackperl.org/2009/12/day-11-using-plackbuilder.html).
-Plack::Request is also supposed to be used from a web application framework to [adapt to PSGI interface](http://advent.plackperl.org/2009/12/day-8-adapting-web-frameworks-to-psgi.html).
+Plack::Request is also supposed to be used from a web application framework to [adapt to PSGI interface](http://advent.plackperl.org/2009/12/day-8-adapting-web-frameworks-to-psgi.html).
@@ -73,4 +73,4 @@ URLMap allows you to compound multiple apps into one app, so combined with Auth
mount "/public" => $app;
};
-This way you run the same `$app` in "/public" and "/private" paths, while "/private" requires a basic authentication and "/public" doesn't. (Inlining `$env->{REMOTE_USER}`, or whatever application logic in .psgi is not really recommended -- i just used it to explain it in an obvious way)
+This way you run the same `$app` in "/public" and "/private" paths, while "/private" requires a basic authentication and "/public" doesn't. (Inlining `$env->{REMOTE_USER}`, or whatever application logic in .psgi is not really recommended -- i just used it to explain it in an obvious way)
@@ -64,4 +64,4 @@ And then using Catalyst::Engine::PSGI and Plack::Builder, you can add a JSONP su
$app;
};
-Accidentally this [Catalyst::View::JSON](http://search.cpan.org/perldoc?Catalyst::View::JSON) is my module :) and supports JSONP callback configuration by default, but there is more than one way to do it!
+Accidentally this [Catalyst::View::JSON](http://search.cpan.org/perldoc?Catalyst::View::JSON) is my module :) and supports JSONP callback configuration by default, but there is more than one way to do it!
@@ -39,4 +39,4 @@ Just like Perl there's more than one way to do it. When you grok how to use [mou
mount "/" => $app;
};
-Your mileage may vary, but I think this one is more obvious. Static's callback based configuration allows you to write more complex regular expression, which you can't do with URLMap and mount, so choose whichever fits your need.
+Your mileage may vary, but I think this one is more obvious. Static's callback based configuration allows you to write more complex regular expression, which you can't do with URLMap and mount, so choose whichever fits your need.
@@ -53,6 +53,3 @@ This application is mapped to `/static` using URLMap, and all requests will try
This will create two applications, one with Catalyst and the other with CGI::Application and runs two applications in order. Suppose you have an overlapping URL structure and `/what/ever.cat` served with the Catalyst application and `/what/ever.cgiapp` served with the CGI::Application app.
Well that might sound crazy and i guess it's better to use URLMap to map two applications in different paths, but if you *really want* to cascade them, this is the way to go :)
-
-
-
@@ -38,4 +38,4 @@ When you develop a new framework adapter or a middleware component, be sure to c
Middleware::Lint validates both request and response interface, so this can be used when you develop a new PSGI web server as well. However if you are a server developer there's a more comprehensive testing tool to make sure your server behaves correctly, and that is Plack::Test::Suite.
-You can look at the existing tests in the `t/Plack-Server` directory for how to use this utility, but it defines lots of expected requests and responses pairs to test a new PSGI server backend. Existing Plack::Server backends included in Plack core distribution as well as other CPAN distributions all pass this test suite.
+You can look at the existing tests in the `t/Plack-Server` directory for how to use this utility, but it defines lots of expected requests and responses pairs to test a new PSGI server backend. Existing Plack::Server backends included in Plack core distribution as well as other CPAN distributions all pass this test suite.
@@ -75,4 +75,3 @@ Proxy middleware is developed by Lee Aylward on [github](http://github.com/leedo
### More
There are more middleware components available in the Plack distribution, and on [CPAN](http://search.cpan.org/search?query=plack+middleware&mode=dist). Not all middleware components are supposed to be great, but certainly they can be shared and used by most frameworks that support PSGI.
-
@@ -108,4 +108,4 @@ Or use the non-DSL API,
$app = MyFramework::Middleware::Foo->wrap($app, ...);
-and they should work just fine.
+and they should work just fine.
View
@@ -20,10 +20,10 @@ Most of the Plack gangs use [github](http://github.com/) for the source control
Again, Plack is a fairly young project. It's just been 3 months since we gave this project a birth. There are many things that could get more improvements, so if you come across one of them, don't stop there. Let us know what you think is a problem, give us an insight how it could be improved, or if you're impatient, fork the project on github and send us patches.
-We're chatting on [IRC channel #plack on irc.perl.org](irc://irc.perl.org/#plack) and there's a [mailing list](http://groups.google.com/group/psgi-plack) and [an issue tracker on github](http://github.com/miyagawa/Plack/issues) to communicate with us.
+We're chatting on IRC channel #plack on irc.perl.org and there's a [mailing list](http://groups.google.com/group/psgi-plack) and [an issue tracker on github](http://github.com/miyagawa/Plack/issues) to communicate with us.
### On a final note...
It's been an interesting experiment of writing 24 articles for 24 days, and I'm glad that I finished this myself. Next year, i'm looking forward to having your own advent entries to make the community based advent calendar.
-I wish you a Very Merry Christmas and a Happy New Year.
+I wish you a Very Merry Christmas and a Happy New Year.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 706c2f5

Please sign in to comment.