{"id":493,"date":"2010-05-27T07:56:23","date_gmt":"2010-05-27T06:56:23","guid":{"rendered":"http:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/"},"modified":"2010-05-27T07:56:23","modified_gmt":"2010-05-27T06:56:23","slug":"plack-the-grand-glue","status":"publish","type":"post","link":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/","title":{"rendered":"Plack, the grand glue"},"content":{"rendered":"<p>I have been looking at <a href=\"http:\/\/search.cpan.org\/dist\/Plack\" rel=\"nofollow\">Plack<\/a> for several months now. I always thought it was a <b>cool project<\/b>, where &quot;cool&quot; means useful, good code, nice documentation, well structured, strong development &quot;flow&quot;, etc&#8230;<\/p>\n<p>Lately I&#39;ve been &quot;rebooting&quot; an internal project, doing a lot of infrastructure work like deployment tools, management of different environments like devel, test, staging and production, bug fixing, etc&#8230; Regular stuff that you usually already take for granted, but this project didn&#39;t have, for many reasons.<\/p>\n<p>After this rebooting work, time has come to add new features to the web-facing part of this project, so new pages and forms. My frustration came from mainly two factors:<\/p>\n<ul>\n<li>the code being tightly integrated with mod_perl<\/li>\n<li>the need to change the apache config every time you add a new <code>\/something<\/code> to the application<\/li>\n<\/ul>\n<p>While the <b>mod_perl integration is not necessarily a bad thing<\/b>, and <a href=\"http:\/\/perl.apache.org\/\" rel=\"nofollow\">mod_perl is a fast and reliable product serving millions of pageviews per day<\/a>, it&#39;s also nice to have code that you can run anywhere, not just on Apache. That might or might not happen, but I&#39;d want to be ready when that&#39;s needed. In fact, we&#39;re starting to use <a href=\"http:\/\/wiki.nginx.org\/Main\" rel=\"nofollow\">nginx<\/a> on some applications, including <b>My Opera<\/b><\/p>\n<p>So I decided to invest some time to play with <a href=\"http:\/\/www.plackperl.org\" rel=\"nofollow\">Plack<\/a>. Plack <b>transposed to Perl concepts from <a href=\"http:\/\/rack.rubyforge.org\/\" rel=\"nofollow\">Ruby&#39;s Rack<\/a> and <a href=\"http:\/\/wsgi.org\/wsgi\/\" rel=\"nofollow\">WSGI<\/a>, a spec born in the Python world I believe.<\/b><\/p>\n<p>I&#39;m still at the first experiments with it, but <b>Plack is a great software with a spectacular potential!<\/b> If you&#39;re in doubt, try it for yourself. What made me decide to try Plack was <a href=\"http:\/\/bulknews.typepad.com\/blog\/2010\/04\/starman-02000-delayed-and-preloadapp.html\" rel=\"nofollow\">Starman<\/a>.\n<\/p>\n<p>Starman is a damn fast PSGI-enabled preforking HTTP web server written in Perl. As soon as I started starman with a stupid simple <code>app.psgi<\/code> I realized I had to invest some time in it.<\/p>\n<p><span class='imgcenter'><img alt='' src='http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png' \/><\/span> <\/p>\n<p>A couple of days later I have the slick <a href=\"http:\/\/www.opera.com\" rel=\"nofollow\">opera.com<\/a> design into a bunch of Template Toolkit blocks, with all machinery to make them work for real, and <b>a PSGI application class<\/b>. From the screenshot you can see this request is loaded in 38 ms, and this my desktop machine, and the <a href=\"http:\/\/search.cpan.org\/dist\/Plack-Middleware-Debug\/\" rel=\"nofollow\">Debug middleware<\/a> gives you useful debugging info through sidebar panels.<\/p>\n<p>I can run this class either as standalone with Starman, or in Apache + mod_perl with <a href=\"http:\/\/search.cpan.org\/~miyagawa\/Plack-0.9938\/lib\/Plack\/Handler\/Apache2.pm\" rel=\"nofollow\">Plack::Handler::Apache2<\/a> or anything else for that matter, like FastCGI, or even plain CGI if you want that.<\/p>\n<p>And I think that shows:<\/p>\n<ul>\n<li>how cool the PSGI\/WSGI concept is<\/li>\n<li>that you can really <b>code once, run anywhere<\/b>, and don&#39;t care about the web server stack<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I have been looking at Plack for several months now. I always thought it was a cool project, where &quot;cool&quot; means useful, good code, nice documentation, well structured, strong development &quot;flow&quot;, etc&#8230; Lately I&#39;ve been &quot;rebooting&quot; an internal project, doing a lot of infrastructure work like deployment tools, management of different environments like devel, test, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[91,341,50,293,229,434,230,48,435],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Plack, the grand glue - Random hacking<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plack, the grand glue - Random hacking\" \/>\n<meta property=\"og:description\" content=\"I have been looking at Plack for several months now. I always thought it was a cool project, where &quot;cool&quot; means useful, good code, nice documentation, well structured, strong development &quot;flow&quot;, etc&#8230; Lately I&#039;ve been &quot;rebooting&quot; an internal project, doing a lot of infrastructure work like deployment tools, management of different environments like devel, test, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\" \/>\n<meta property=\"og:site_name\" content=\"Random hacking\" \/>\n<meta property=\"article:published_time\" content=\"2010-05-27T06:56:23+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png\" \/>\n<meta name=\"author\" content=\"cosimo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cosimo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\"},\"author\":{\"name\":\"cosimo\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"headline\":\"Plack, the grand glue\",\"datePublished\":\"2010-05-27T06:56:23+00:00\",\"dateModified\":\"2010-05-27T06:56:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\"},\"wordCount\":444,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"image\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png\",\"keywords\":[\"development\",\"mod_perl\",\"perl\",\"plack\",\"PSGI\",\"rack\",\"starman\",\"web\",\"WSGI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\",\"name\":\"Plack, the grand glue - Random hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png\",\"datePublished\":\"2010-05-27T06:56:23+00:00\",\"dateModified\":\"2010-05-27T06:56:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage\",\"url\":\"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png\",\"contentUrl\":\"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plack, the grand glue\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#website\",\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/\",\"name\":\"Random hacking\",\"description\":\"Assume nothing. Code defensively. Keep it simple, stupid!\",\"publisher\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1\",\"name\":\"cosimo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g\",\"caption\":\"cosimo\"},\"logo\":{\"@id\":\"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Plack, the grand glue - Random hacking","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/","og_locale":"en_US","og_type":"article","og_title":"Plack, the grand glue - Random hacking","og_description":"I have been looking at Plack for several months now. I always thought it was a cool project, where &quot;cool&quot; means useful, good code, nice documentation, well structured, strong development &quot;flow&quot;, etc&#8230; Lately I&#39;ve been &quot;rebooting&quot; an internal project, doing a lot of infrastructure work like deployment tools, management of different environments like devel, test, [&hellip;]","og_url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/","og_site_name":"Random hacking","article_published_time":"2010-05-27T06:56:23+00:00","og_image":[{"url":"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png"}],"author":"cosimo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cosimo","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#article","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/"},"author":{"name":"cosimo","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"headline":"Plack, the grand glue","datePublished":"2010-05-27T06:56:23+00:00","dateModified":"2010-05-27T06:56:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/"},"wordCount":444,"commentCount":0,"publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"image":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage"},"thumbnailUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png","keywords":["development","mod_perl","perl","plack","PSGI","rack","starman","web","WSGI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/","url":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/","name":"Plack, the grand glue - Random hacking","isPartOf":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage"},"image":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage"},"thumbnailUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png","datePublished":"2010-05-27T06:56:23+00:00","dateModified":"2010-05-27T06:56:23+00:00","breadcrumb":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#primaryimage","url":"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png","contentUrl":"http:\/\/files.myopera.com\/cstrep\/blog\/plack-example.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/2010\/05\/plack-the-grand-glue\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.streppone.it\/cosimo\/blog\/"},{"@type":"ListItem","position":2,"name":"Plack, the grand glue"}]},{"@type":"WebSite","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#website","url":"https:\/\/www.streppone.it\/cosimo\/blog\/","name":"Random hacking","description":"Assume nothing. Code defensively. Keep it simple, stupid!","publisher":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.streppone.it\/cosimo\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/c443bedbf6ecf99550d6395620801df1","name":"cosimo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cb1d938720df45a2720724aae99e3bfc?s=96&r=g","caption":"cosimo"},"logo":{"@id":"https:\/\/www.streppone.it\/cosimo\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.streppone.it\/cosimo\/blog\/author\/cosimo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/493"}],"collection":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":0,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.streppone.it\/cosimo\/blog\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}