<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog.gauner.org</title>
	<atom:link href="http://blog.gauner.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gauner.org</link>
	<description>"When the power of love overcomes the love of power, the world will know peace." - Sri Chinmoy Ghose</description>
	<lastBuildDate>Sun, 06 Jan 2013 20:17:31 +0000</lastBuildDate>
	<language>de-DE</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>scp over IP6 link local address</title>
		<link>http://blog.gauner.org/blog/2013/01/06/scp-over-ip6-link-local-address/</link>
		<comments>http://blog.gauner.org/blog/2013/01/06/scp-over-ip6-link-local-address/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 20:17:31 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Verschiedenes]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1255</guid>
		<description><![CDATA[When trying to copy some large files between two PCs I was annoyed by the slow wifi and did connect both by a direct LAN cable. But since I didn&#8217;t want to manually configure IPs I did remember that IPv6 would give each interface an unique link-local address immedeately. So I went on to figure [...]]]></description>
				<content:encoded><![CDATA[<p>When trying to copy some large files between two PCs I was annoyed by the slow wifi and did connect both by a direct LAN cable. But since I didn&#8217;t want to manually configure IPs I did remember that IPv6 would give each interface an unique link-local address immedeately. So I went on to figure out how to correctly pass this address to ssh/scp.</p>
<p>Let&#8217;s assume the link-local address of &#8216;fe80::f4de:ff1f:fa5e:feee&#8217;.</p>
<p>First try: ssh user@fe80::f4de:ff1f:fa5e:feee</p>
<p>This won&#8217;t work because these link-local addresses are only unique on a given link. So you need to specify the interface as well.</p>
<p>Second try: ssh user@fe80::f4de:ff1f:fa5e:feee%en0</p>
<p>Of course you have to change the interface identifier acording to your system. On Linux this would most probably be eth0.</p>
<p>This was find for ssh, but for scp I did also need a remote source directory.</p>
<p>Third try: scp -6 user@fe80::f4de:ff1f:fa5e:feee%en0:/some/path/</p>
<p>This won&#8217;t work because the colons confuse ssh. You need to be more explicit by using square brackets.</p>
<p>Forth and final try: scp -6 user@[fe80::f4de:ff1f:fa5e:feee%en0]:/some/path/ .</p>
<p>Figuring out why this is no auto-generated link-local address is left as an exercise to the reader (but not relevant for this post).</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1255&amp;md5=b1efb1caece017abf2e693d7cf1fe6cc" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2013/01/06/scp-over-ip6-link-local-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2013%2F01%2F06%2Fscp-over-ip6-link-local-address%2F&amp;language=en_GB&amp;category=text&amp;title=scp+over+IP6+link+local+address&amp;description=When+trying+to+copy+some+large+files+between+two+PCs+I+was+annoyed+by+the+slow+wifi+and+did+connect+both+by+a+direct+LAN+cable.+But+since+I+didn%26%238217%3Bt...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>GitLab behind a Reverse-Proxy</title>
		<link>http://blog.gauner.org/blog/2012/12/04/gitlab-behind-a-reverse-proxy/</link>
		<comments>http://blog.gauner.org/blog/2012/12/04/gitlab-behind-a-reverse-proxy/#comments</comments>
		<pubDate>Tue, 04 Dec 2012 17:04:08 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Verschiedenes]]></category>
		<category><![CDATA[git gitlab nginx]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1252</guid>
		<description><![CDATA[Running GitLab behind a (second) Reverse-Proxy over https? In that case you should undefine the &#8220;proxy_set_header X-Forwarded-Proto&#8221; header in the backend nginx and set it in the frontend nginx. Otherwise GitLab/RoR will redirect you to http on various ocasions. You should also set https in the config/gitlab.yml.]]></description>
				<content:encoded><![CDATA[<p>Running GitLab behind a (second) Reverse-Proxy over https?</p>
<p>In that case you should undefine the &#8220;proxy_set_header   X-Forwarded-Proto&#8221; header in the backend nginx and set it in the frontend nginx. Otherwise GitLab/RoR will redirect you to http on various ocasions. You should also set https in the config/gitlab.yml.</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1252&amp;md5=690878b50c8b5f8e4e67e2c79cefa566" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/12/04/gitlab-behind-a-reverse-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F12%2F04%2Fgitlab-behind-a-reverse-proxy%2F&amp;language=en_GB&amp;category=text&amp;title=GitLab+behind+a+Reverse-Proxy&amp;description=Running+GitLab+behind+a+%28second%29+Reverse-Proxy+over+https%3F+In+that+case+you+should+undefine+the+%26%238220%3Bproxy_set_header+X-Forwarded-Proto%26%238221%3B+header+in+the+backend+nginx+and+set+it+in+the+frontend+nginx.+Otherwise...&amp;tags=git+gitlab+nginx%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Escaping Filenames with Whitespaces for rsync</title>
		<link>http://blog.gauner.org/blog/2012/10/15/escaping-filenames-with-whitespaces-for-rsync/</link>
		<comments>http://blog.gauner.org/blog/2012/10/15/escaping-filenames-with-whitespaces-for-rsync/#comments</comments>
		<pubDate>Mon, 15 Oct 2012 06:47:27 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1246</guid>
		<description><![CDATA[If you need to sync from a source path containing whitespaces you&#8217;ll need to escape those for the remote shell as well as for the local shell, so your command may look like this: rsync -ae ssh &#8216;user@host.tld:/path/with\ some/gaps/&#8217; &#8216;/another/one with/ a gap/&#8217; Don&#8217;t escape the whitespaces on the local side twice or you&#8217;ll end [...]]]></description>
				<content:encoded><![CDATA[<p>If you need to sync from a source path containing whitespaces you&#8217;ll need to escape those for the remote shell as well as for the local shell, so your command may look like this:</p>
<p>rsync -ae ssh &#8216;user@host.tld:/path/with\ some/gaps/&#8217; &#8216;/another/one with/ a gap/&#8217;</p>
<p>Don&#8217;t escape the whitespaces on the local side twice or you&#8217;ll end up with weired filenames!</p>
<p><a href="http://raamdev.com/2008/escaping-filename-or-directory-spaces-for-rsync/">Via</a></p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1246&amp;md5=3898f32fb16515ba28ca291770945380" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/10/15/escaping-filenames-with-whitespaces-for-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F10%2F15%2Fescaping-filenames-with-whitespaces-for-rsync%2F&amp;language=en_GB&amp;category=text&amp;title=Escaping+Filenames+with+Whitespaces+for+rsync&amp;description=If+you+need+to+sync+from+a+source+path+containing+whitespaces+you%26%238217%3Bll+need+to+escape+those+for+the+remote+shell+as+well+as+for+the+local+shell%2C+so+your+command...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>git: Rebase vs. Rebase</title>
		<link>http://blog.gauner.org/blog/2012/10/08/git-rebase-vs-rebase/</link>
		<comments>http://blog.gauner.org/blog/2012/10/08/git-rebase-vs-rebase/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 17:44:06 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[GIT]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1243</guid>
		<description><![CDATA[For a some time I&#8217;ve wondered about git rebase. At some point in the past I&#8217;ve realised that there is not one use in git rebase but (at least) two distict ones. On the one hand git rebase is used to rebase a branch onto an updated source branch (source like in origin, not in [...]]]></description>
				<content:encoded><![CDATA[<p>For a some time I&#8217;ve wondered about git rebase. At some point in the past I&#8217;ve realised that there is not one use in git rebase but (at least) two distict ones.</p>
<ul>
<li>On the one hand git rebase is used to <strong>rebase a branch onto an updated source branch</strong> (source like in origin, not in source code).</li>
<li>On the other hand it&#8217;s used to<strong> rewrite commit history</strong>.</li>
</ul>
<h3><strong>What&#8217;s rebase?</strong></h3>
<p>A rebase makes git <strong>rewind</strong> your commit history up to a certain point and than re-apply your patches onto another starting point. The starting point depends on the exact type of rebase you do and what you tell git.</p>
<h3>Rebase a branch</h3>
<p>Why would you want to rebase a branch onto another one and what does it do?</p>
<p>If you have a feature branch and want this to be merged with your master branch you could of course <strong>merge</strong> it. If you do so and your feature branch is not based of the last commit in master git will create a new merge commit since it has to merge two branches of a tree. If you&#8217;d rebase your feature branch onto the tip of master you&#8217;d have a linear merge history w/o a merge commit instead.</p>
<h3>Rewrite a branch</h3>
<p>Why would you want to rewrite your commit history? What if you make mistakes while crafting a new branch? If you&#8217;re following common VCS advice you&#8217;ll probably commit often. Probably between some mistake you&#8217;ve made and the time you did correct it.</p>
<p>Now you&#8217;d have your shiny new feature commit and two or more commits w/ bugfixes to your initial commit in this feature branch. Some people prefer to keep the history of their mistakes. Those could just merge this new feature branch into their master branch.</p>
<p>Others prefer to keep their commit history clean (you wouldn&#8217;t release a book which includes all mistakes and corrections you&#8217;ve made, would you?). Here comes <strong>git rebase -i</strong><strong></strong> to the rescue. This rebases the current branch onto itself. This may sound a bit silly but it allows you to <strong>drop</strong> commits or more importantly to <strong>combine</strong> (<em>squash</em>) commits together!</p>
<h3>Where to got from here?</h3>
<p>This post wasn&#8217;t meant to give a complete introduction to git rebasing. There are plenty of great tutorials out there. I did just want to highlight some points which were important to me.</p>
<ul>
<li><a href="http://git-scm.com/book/en/Git-Branching-Rebasing">Git-Branching-Rebasing</a></li>
<li><a href="http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html">git-rebase(1)</a></li>
<li><a href="http://gitready.com/intermediate/2009/01/31/intro-to-rebase.html">intro to rebase</a></li>
<li><a href="http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html">When to rebase</a> (READ!)</li>
</ul>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1243&amp;md5=c06d181b38ca73b1fdffdca2d2589113" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/10/08/git-rebase-vs-rebase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F10%2F08%2Fgit-rebase-vs-rebase%2F&amp;language=en_GB&amp;category=text&amp;title=git%3A+Rebase+vs.+Rebase&amp;description=For+a+some+time+I%26%238217%3Bve+wondered+about+git+rebase.+At+some+point+in+the+past+I%26%238217%3Bve+realised+that+there+is+not+one+use+in+git+rebase+but+%28at+least%29+two...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Watching 3D Movies in 2D using Mplayer</title>
		<link>http://blog.gauner.org/blog/2012/10/08/watching-3d-movies-in-2d-using-mplayer/</link>
		<comments>http://blog.gauner.org/blog/2012/10/08/watching-3d-movies-in-2d-using-mplayer/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 16:16:38 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1240</guid>
		<description><![CDATA[In case you&#8217;ve got an 3D Movie w/o an 3D capable output device try mplayer w/ the &#8220;-vo gl:stereo=3&#8243; switch to get it in 2D. It works at least on Linux w/ an Nvidia Card.]]></description>
				<content:encoded><![CDATA[<p>In case you&#8217;ve got an 3D Movie w/o an 3D capable output device try mplayer w/ the &#8220;-vo gl:stereo=3&#8243; switch to get it in 2D. It works at least on Linux w/ an Nvidia Card.</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1240&amp;md5=2c2134dc881917f0430897902a22fb15" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/10/08/watching-3d-movies-in-2d-using-mplayer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F10%2F08%2Fwatching-3d-movies-in-2d-using-mplayer%2F&amp;language=en_GB&amp;category=text&amp;title=Watching+3D+Movies+in+2D+using+Mplayer&amp;description=In+case+you%26%238217%3Bve+got+an+3D+Movie+w%2Fo+an+3D+capable+output+device+try+mplayer+w%2F+the+%26%238220%3B-vo+gl%3Astereo%3D3%26%238243%3B+switch+to+get+it+in+2D.+It+works+at+least+on...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Perl Tutorials</title>
		<link>http://blog.gauner.org/blog/2012/08/21/perl-tutorials/</link>
		<comments>http://blog.gauner.org/blog/2012/08/21/perl-tutorials/#comments</comments>
		<pubDate>Tue, 21 Aug 2012 15:12:05 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Verschiedenes]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1237</guid>
		<description><![CDATA[Looking for Perl Tutorials? Go ahead: http://perl-tutorial.org/.]]></description>
				<content:encoded><![CDATA[<p>Looking for Perl Tutorials? Go ahead: <a href="http://perl-tutorial.org/" title="Perl Tutorials">http://perl-tutorial.org/</a>.</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1237&amp;md5=5f94d499ab1acd53f593c69824ba9269" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/08/21/perl-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F08%2F21%2Fperl-tutorials%2F&amp;language=en_GB&amp;category=text&amp;title=Perl+Tutorials&amp;description=Looking+for+Perl+Tutorials%3F+Go+ahead%3A+http%3A%2F%2Fperl-tutorial.org%2F.&amp;tags=perl%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Options for running Linux-Vserver on Debian wheezy</title>
		<link>http://blog.gauner.org/blog/2012/07/16/options-for-running-linux-vserver-on-debian-wheezy/</link>
		<comments>http://blog.gauner.org/blog/2012/07/16/options-for-running-linux-vserver-on-debian-wheezy/#comments</comments>
		<pubDate>Mon, 16 Jul 2012 13:24:32 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1234</guid>
		<description><![CDATA[&#160; If you&#8217;re running Debian squezze with a Linux-Vserver kernel you&#8217;ll soon have to face the fact that support for non-mainline virtualization patches will soon be dropped from Debian stable. The Debian kernel team stated very clearly that they won&#8217;t continue to provide custom patched kernel packages. In general I think that is a very [...]]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>If you&#8217;re running Debian squezze with a Linux-Vserver kernel you&#8217;ll soon have to face the fact that support for non-mainline virtualization patches will soon be dropped from Debian stable.</p>
<p>The Debian kernel team <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625811">stated very clearly</a> that they won&#8217;t continue to provide custom patched kernel packages. In general I think that is a very good decision. Taking the workload for the team into account and the unwillingness of the Linux-Vserver and OpenVZ maintainers to cooperate with Debian this is very much understood.</p>
<p>So what to do now if have vservers running your business?</p>
<p>These are the options I could think of so far, feel free to suggest further:</p>
<ul>
<li>Stay with Squeeze</li>
<li>LXC</li>
<li>KVM w/ Squeeze VM</li>
<li>VMWare ESXi w/ Squeeze VM</li>
<li>Custom patched Kernel</li>
<li>Xen w/ Squeeze domU</li>
</ul>
<h1>Staying with Squeeze</h1>
<p>If you plan to stay with squeeze you&#8217;re good to go for quite a while. Of course squeeze security updates will end some time after the Wheezy release, but what to do with newer hardware which is not supported by Squeeze? So not an option I think.</p>
<h1>LXC</h1>
<p>Linux Containers (LXC) are the preferred contextualization from Wheezy on. They are maintained within the mainline kernel are said to have a very good intregration with it. The biggest drawback however, are the userspace tools. While the team developing those used to be quite active it has slowed down a bit recently without having brought the tools anywhere close to util-vserver &#8211; which aren&#8217;t perfekt either.</p>
<h1>KVM w/ Squeeze VM and Vserver Kernel</h1>
<p>You could run Wheezy or Squeeze w/ an Backport Kernel on your host and run an squeeze vserver kernel inside KVM. That sounds ugly and means having to set up a network bridge on your host.</p>
<h1>KVM</h1>
<p>Of course you could also turn all your vservers into KVM VMs. This is very much work and means completly migrating to an entirely differnt virtualization architecture. Not very nice.</p>
<h1>VMWare ESXi</h1>
<p>Long story short: The management of an ESXi is an PITA.</p>
<h1>
Xen w/ Squeeze VM and Vserver Kernel</h1>
<p>Same as KVM w/ Squeeze kernel. See above.</p>
<h1>Xen</h1>
<p>Same as KVM. See above.</p>
<h1>Custom patched Kernel</h1>
<p>While the Linux-Vserver team isn&#8217;t always cheered about debian they are still very active and continue to provide patches for recent kernel. The biggest drawbacks here are, that you have to care about security update yourself and that you need to build a custom set of util-vserver. Older versions from squeeze won&#8217;t work with newer kernels.</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1234&amp;md5=2c7d0622c8b0a367d1f9cc214c698a97" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/07/16/options-for-running-linux-vserver-on-debian-wheezy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F07%2F16%2Foptions-for-running-linux-vserver-on-debian-wheezy%2F&amp;language=en_GB&amp;category=text&amp;title=Options+for+running+Linux-Vserver+on+Debian+wheezy&amp;description=%26nbsp%3B+If+you%26%238217%3Bre+running+Debian+squezze+with+a+Linux-Vserver+kernel+you%26%238217%3Bll+soon+have+to+face+the+fact+that+support+for+non-mainline+virtualization+patches+will+soon+be+dropped+from+Debian+stable....&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Migrating to PSGI/Plack</title>
		<link>http://blog.gauner.org/blog/2012/05/20/migrating-to-psgiplack/</link>
		<comments>http://blog.gauner.org/blog/2012/05/20/migrating-to-psgiplack/#comments</comments>
		<pubDate>Sun, 20 May 2012 15:02:08 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Verschiedenes]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1227</guid>
		<description><![CDATA[Have you heard of PSGI/Plack? It&#8217;s that awesome Perl meta-webframework you&#8217;re looking for. Unfortuneately it&#8217;s not that easy to get started with because the documentation is a bit too euphoric. They talk about &#8220;superglue&#8221; and &#8220;duct tape for the web&#8221; but fall a bit short of explaining how to get started with it. Shortcut: It [...]]]></description>
				<content:encoded><![CDATA[<p>Have you heard of <a href="http://www.plackperl.org/">PSGI/Plack</a>?</p>
<p>It&#8217;s that awesome Perl meta-webframework you&#8217;re looking for. Unfortuneately it&#8217;s not that easy to get started with because the documentation is a bit too euphoric. They talk about &#8220;superglue&#8221; and &#8220;duct tape for the web&#8221; but fall a bit short of explaining how to get started with it.</p>
<p><strong>Shortcut:</strong> It you&#8217;re using one of the supported frameworks (like Catalyst oder CGI::Application 4.5+) you shouldn&#8217;t need to work about anything of this. How to get those running w/ PSGI is explained in sufficient details in various docs.</p>
<p>This post is for those who need to do it w/o an framework or want to know the internals. Well, I&#8217;m not going into great detail in this post, only the essentials.</p>
<ul>
<li><strong>What is PSGI? </strong>PSGI is a specification of a protocol spoken between a PSGI compliant Server and the WebApp. The WebApp is talking PSGI to it&#8217;s executing server and this server is talking whatever he likes to his downstream (e.g. HTTP, FCGI, &#8230;)</li>
<li><strong>What is Plack?</strong> Plack is a set of tools implementing PSGI. It provides some PSGI compliant Server implementations on its own and help others building their PSGI servers. It&#8217;s also some kind of meta-framework (&#8220;middleware&#8221;) that implements such things like Session management, authentication and compression. <strong>You don&#8217;t have to use those features!</strong> You don&#8217;t even need to known that they are there, but if you want you can have a look.</li>
<li><strong>What is $env?</strong> This is a HashRef containing the environment for your request? Why env, you ask? Well, probably because CGI get it&#8217;s parameters passed via the OS &#8216;environment&#8217; and they just adopted that for PSGI.</li>
<li><strong>What is the PSGI-triplet?</strong> Well, that&#8217;s just the name I gave to the data structure PSGI expects to get returned after a request has been processed. It contains the HTTP-Statuscode, an ArrayRef with the HTTP-Header pairs and an ArrayRef containing the Body.</li>
</ul>
<p>So, how do I migrate my framework-less perl web application to being PSGI compliatnt?</p>
<ul>
<li>Throw out CGI, CGI::Carp and possibly FCGI. You won&#8217;t be using them anymore. You&#8217;ll be using Plack::Request instead.</li>
<li>Make your App &#8220;persistence-compatible&#8221;. That means you&#8217;ll have to abandon any global (class) variables thats only valid for one request. Every class variable must be valid throughout the entire runtime of your server  (because your class is instantiated only once, at the PSGI-Servers startup. There are excpetions to this, but keep it as a rule of thumb). Every information that is only valid for one request must be passed between the methods. If you have much pass around put if into a custom request class or a HashRef.</li>
<li>Make sure your class has a method handling the request. You probably have that already, but you should name it &#8216;run&#8217;. It will get passed the $env. Use that directly or create your custom per-request data structure from there.</li>
<li>Remove any direct output to STDOUT. Make your app return the PSGI-triplet to the caller. Everywhere.</li>
<li>Create a webapp.psgi, see below for it&#8217;s content and possible a webapp.pl if you want to support plain old CGI.</li>
<li>plackup webapp.psgi</li>
</ul>
<p><strong>webapp.psgi</strong></p>
<pre class="perl">#!/usr/bin/perl
use strict;
use warnings;

use lib '../lib';

use MyApp::Web::Frontend;

# The important part here is to instantiate your WebApp Class before
# the closure is defined. Everything inside the sub is executed on each
# request. If you instantiate your class inside you'll loose any benefit
# you get by not using CGI.
my $Frontend = MyApp::Web::Frontend::-&gt;new();
my $app = sub {
    my $env = shift;

    return $Frontend-&gt;run($env);
};</pre>
<p><strong>webapp.pl</strong></p>
<pre class="perl">#!/usr/bin/perl
use strict;
use warnings;

# Warning: This script will only work properly when invoked with
# the correct environment. Plack::Loader tries to autodetect the
# proper server and will use CGI only if certain CGI environment
# variables are set. It will most specifically not work properly
# when run from the commandline.
use Plack::Loader;

my $app = Plack::Util::load_psgi("webapp.psgi");
Plack::Loader::-&gt;auto-&gt;run($app);</pre>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1227&amp;md5=1c3d6a9e0e30957b5458a6dc94ce47f0" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/05/20/migrating-to-psgiplack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F05%2F20%2Fmigrating-to-psgiplack%2F&amp;language=en_GB&amp;category=text&amp;title=Migrating+to+PSGI%2FPlack&amp;description=Have+you+heard+of+PSGI%2FPlack%3F+It%26%238217%3Bs+that+awesome+Perl+meta-webframework+you%26%238217%3Bre+looking+for.+Unfortuneately+it%26%238217%3Bs+not+that+easy+to+get+started+with+because+the+documentation+is+a+bit+too+euphoric....&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Stop writing useless programs</title>
		<link>http://blog.gauner.org/blog/2012/05/02/stop-writing-useless-programs/</link>
		<comments>http://blog.gauner.org/blog/2012/05/02/stop-writing-useless-programs/#comments</comments>
		<pubDate>Wed, 02 May 2012 12:20:09 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1223</guid>
		<description><![CDATA[&#8220;Stop-writing-useless-programs&#8221; It&#8217;s kinda rude, but they aren&#8217;t entirely wrong &#8230;]]></description>
				<content:encoded><![CDATA[<p>&#8220;<a href="http://www.change.org/petitions/lennart-poettering-stop-writing-useless-programs-systemd-journal">Stop-writing-useless-programs</a>&#8221;</p>
<p>It&#8217;s kinda rude, but they aren&#8217;t entirely wrong &#8230;</p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1223&amp;md5=14d3804a1c661fa737248002f0608043" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/05/02/stop-writing-useless-programs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F05%2F02%2Fstop-writing-useless-programs%2F&amp;language=en_GB&amp;category=text&amp;title=Stop+writing+useless+programs&amp;description=%26%238220%3BStop-writing-useless-programs%26%238221%3B+It%26%238217%3Bs+kinda+rude%2C+but+they+aren%26%238217%3Bt+entirely+wrong+%26%238230%3B&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Car rental for dummies</title>
		<link>http://blog.gauner.org/blog/2012/04/23/car-rental-for-dummies/</link>
		<comments>http://blog.gauner.org/blog/2012/04/23/car-rental-for-dummies/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 07:00:28 +0000</pubDate>
		<dc:creator>tex</dc:creator>
				<category><![CDATA[Verschiedenes]]></category>

		<guid isPermaLink="false">http://blog.gauner.org/?p=1210</guid>
		<description><![CDATA[If you&#8217;ve never rented a car before, like me, you should remember some things. Always rent at a large, well known company, preferable one that does business in your home country, too. Always pick up the car at large rental station, e.g. at the airport Always order an GPS/Navigation System Always check the car thoroughly [...]]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;ve never rented a car before, like me, you should remember some things.</p>
<ul>
<li>Always rent at a large, well known company, preferable one that does business in your home country, too.</li>
<li>Always pick up the car at large rental station, e.g. at the airport</li>
<li>Always order an GPS/Navigation System</li>
<li>Always check the car thoroughly before leaving the premises of the rental station</li>
</ul>
<p>Good luck <img src='http://blog.gauner.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
 <p><a href="http://blog.gauner.org/?flattrss_redirect&amp;id=1210&amp;md5=d9aad00035dd9292c78beb58c70ea705" title="Flattr" target="_blank"><img src="http://blog.gauner.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.gauner.org/blog/2012/04/23/car-rental-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" title="Flattr this!" href="https://flattr.com/submit/auto?user_id=tex&amp;popout=1&amp;url=http%3A%2F%2Fblog.gauner.org%2Fblog%2F2012%2F04%2F23%2Fcar-rental-for-dummies%2F&amp;language=en_GB&amp;category=text&amp;title=Car+rental+for+dummies&amp;description=If+you%26%238217%3Bve+never+rented+a+car+before%2C+like+me%2C+you+should+remember+some+things.+Always+rent+at+a+large%2C+well+known+company%2C+preferable+one+that+does+business+in+your+home...&amp;tags=blog" type="text/html" />
	</item>
	</channel>
</rss>
