<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Ævar Arnfjörð Bjarmason</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/" />
    <link rel="self" type="application/atom+xml" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/atom.xml" />
    <id>tag:blogs.perl.org,2009-11-03:/users/aevar_arnfjor_bjarmason//204</id>
    <updated>2013-01-06T15:42:17Z</updated>
    <subtitle>my Perl $blog;</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.38</generator>

<entry>
    <title>I would like to buy a Hailo</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2013/01/i-would-like-to-buy-a-hailo.html" />
    <id>tag:blogs.perl.org,2013:/users/aevar_arnfjor_bjarmason//204.4179</id>

    <published>2013-01-06T15:34:23Z</published>
    <updated>2013-01-06T15:42:17Z</updated>

    <summary>Myself and the other author of Hailo just got what looks to be very odd spam asking us whether someone could buy a copy of Hailo. Here&apos;s an E-Mail that was sent to Hinrik: I want to buy a Marklov pluggable engine, Where can i buy one, i am coming to Iceland for a visit, can i come to your...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
    <category term="hailo" label="Hailo" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="spam" label="spam" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Myself and the other author of <a href="https://metacpan.org/module/Hailo">Hailo</a> just got what looks to be very odd spam asking us whether someone could buy a copy of Hailo.</p>

<p>Here's an E-Mail that was sent to Hinrik:</p>

<pre><code>I want to buy a Marklov pluggable engine, Where can i buy one, i am coming to
Iceland for a visit, can i come to your shop?
</code></pre>

<p>And, in another E-Mail sent to me:</p>

<pre><code>Hi,
I would like to buy a Hailo. Where can i get one and how much do they cost?
Thanks Julie
</code></pre>

<p>Clearly I should quit my dayjob and start selling copies of Hailo on CD in a dedicated store just for this purpose.</p>

<p>More seriously though, is anyone else getting similar spam these days about their CPAN distros? It seems odd to get a couple of these E-Mails within a few days.</p>

<p>We did have someone contact us a couple of years ago legitimately wanting to buy a license for of Hailo. It took quite a long E-Mail exchange to convince that person that yes, we were in fact giving it away for free.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>My blogs.perl.org profile image is now some other dude</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2012/07/my-blogsperlorg-profile-image-is-now-some-other-dude.html" />
    <id>tag:blogs.perl.org,2012:/users/aevar_arnfjor_bjarmason//204.3615</id>

    <published>2012-07-26T16:20:33Z</published>
    <updated>2012-07-26T16:22:35Z</updated>

    <summary>I just filed a bug about my profile image being replaced by that of some other user on the site. I wonder if anyone else had had this issue....</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I just filed <a href="https://github.com/davorg/blogs.perl.org/issues/156">a bug</a> about my profile image being replaced by that of some other user on the site. I wonder if anyone else had had this issue.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Tweaking what Moose does when a type constraint fails</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2012/05/tweaking-what-moose-does-when-a-type-constraint-fails.html" />
    <id>tag:blogs.perl.org,2012:/users/aevar_arnfjor_bjarmason//204.3187</id>

    <published>2012-05-02T21:30:17Z</published>
    <updated>2012-05-02T21:34:05Z</updated>

    <summary>Back when Curtis Poe was at Booking.com we were in the the first team to use Moose (actually Mouse at the time) for anything serious. While it saved us a lot of time overall that we&apos;d otherwise have spend on writing boilerplate code we found the Moose support for type constraints to be fairly inflexible for our purposes. Moose will...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="Booking.com" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Moose" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="moose" label="Moose" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="moosex" label="MooseX" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Back when Curtis Poe was at Booking.com we were in the the first team to use Moose (actually Mouse at the time) for anything serious. While it saved us a lot of time overall that we'd otherwise have spend on writing boilerplate code we found the Moose support for type constraints to be fairly inflexible for our purposes.</p>

<p>Moose will simple die if you pass it a value that violates a type constraint, in an environment where you control the whole stack this is usually what you want, but when you're dealing with data from other people and user-supplied parameters you often want to handle the situation more gracefully.</p>

<p>Curtis pointed this out on the <a href="http://www.nntp.perl.org/group/perl.moose/2011/06/msg2151.html">Moose mailing list</a>, and quickly found that this was something covered in the <a href="https://metacpan.org/module/Moose::Manual::FAQ#Can-I-turn-off-type-constraint-checking-">Moose FAQ</a>.</p>

<p>I hacked up something that would change the behavior globally, but of course this is something you want to do on a per-attribute level. Jesse Luehrs provided a basic implementation of it which I expanded on, and which I've now uploaded to the CPAN as <a href="https://metacpan.org/module/MooseX::Attribute::TypeConstraint::CustomizeFatal">MooseX::Attribute::TypeConstraint::CustomizeFatal</a></p>

<p>The module allows you to tweak what Moose does when a type constraint fails on a per-attribute level. The default is to die as Moose does by default, but you can also make it warn and accept the bad value, or warn and fall back on the default value, or just silently ignore the bad value and fall back on the default value.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>qr/STRING/msixpodual or qr/STRING/mixuploads ?</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2011/02/qrstringmsixpodual-or-qrstringmixuploads.html" />
    <id>tag:blogs.perl.org,2011:/users/aevar_arnfjor_bjarmason//204.1489</id>

    <published>2011-02-21T00:10:47Z</published>
    <updated>2011-02-21T00:15:56Z</updated>

    <summary>I released perl 5.13.10 today. I might write more about that later. But one significant change in it is that Perl now has many more regex flags. So I wrote a short one-off script to find out what words I cound construct from the flags. Now it just gives you one word that contains as many of the flags as...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="5.13" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="5.14" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Perl" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="fun" label="fun" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="regex" label="regex" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169340.html">released</a> perl 5.13.10 today. I might write more about that later. But one significant change in it is that Perl now has many more regex flags.</p>

<p>So I wrote a <a href="https://gist.github.com/836425">short one-off script</a> to <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/02/msg169360.html">find out what words</a> I cound construct from the flags.</p>

<p>Now it just gives you one word that contains as many of the flags as possible, and gives you the remainder. What would be more interesting would be to detect cases where multiple valid words can be made from the flags. E.g. "mix" and "uploads". It just detected that by accident.</p>

<p>I leave that as an exercise for the reader.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Moving to Amsterdam to work for Booking.com</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/10/moving-to-amsterdam-to-work-for-bookingcom.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.1107</id>

    <published>2010-10-12T17:51:24Z</published>
    <updated>2010-10-12T17:55:20Z</updated>

    <summary>I thought I&apos;d note here too as well as on my blog that I&apos;ll be moving to Amsterdam tomorrow to work for Booking.com. I&apos;m looking forward to the new challenges and getting settled in a new city, as well as meeting and working with some new people....</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
    <category term="amsterdam" label="Amsterdam" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="bookingcom" label="Booking.com" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="personal" label="personal" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I thought I'd note here too as well as <a href="http://xn--var-xla.net/2010/10/12/Moving-to-Amsterdam/">on my blog</a> that I'll be moving to Amsterdam tomorrow to work for <a href="http://booking.com">Booking.com</a>. I'm looking forward to the new challenges and getting settled in a new city, as well as meeting and working with <a href="http://blogs.perl.org/users/ovid/2010/09/amsterdam.html">some</a> <a href="http://blogs.perl.org/users/steffen_mueller/">new</a> people.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>The CPAN client version-less dependency problem</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/10/the-cpan-client-version-less-dependency-problem.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.1094</id>

    <published>2010-10-07T18:27:33Z</published>
    <updated>2010-10-08T15:15:06Z</updated>

    <summary>An interesting topic came up on #distzilla. Most modules depend on other modules, but some don&apos;t depend on an explicit version. So if you use the module with an ancient version of one of its dependencies it&apos;ll break, because the author never tested that version. We&apos;ve probably all run into problems as a result of this and grudgingly upgraded the...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="CPAN" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="bikeshedding" label="bikeshedding" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>An interesting topic came up on <code>#distzilla</code>. Most modules depend on other modules, but some don't depend on an explicit version. So if you use the module with an ancient version of one of its dependencies it'll break, because the author never tested that version.</p>

<p>We've probably all run into problems as a result of this and grudgingly upgraded the dependencies as a result, but could CPAN clients handle this better?</p>

<p>Technically they're doing the right thing already. The CPAN clients are unable to distinguish between "explicit 0", "any version will do" and "author didn't say".</p>

<ul>
<li>Some don't specify versions at all. I mostly fall into this camp.</li>
<li>Even if you specify a version for every dependency it's really hard to get it right. You might accidentally use some API feature in a dependency that doesn't match the feature set of your declared version.</li>
<li>Even if you get it 100% right it's all for naught if one of your dependencies isn't as careful about its dependencies.</li>
</ul>

<p>So what would be a better heuristic? Some suggestions:</p>

<ul>
<li><p>Make sure that dependencies aren't much older than the module that requires them. Something in the spirit of:</p>

<p>Are you sure you want to install this shiny new version of Web::Some::Thingy but
still use your 4 year old copy of DBD::SQLite? Install the new DBD::SQLite? [Y/n]</p></li>
<li><p>Query some publicly available submission system like the CPAN metabase:</p>

<p>You're trying to install Web::Some::Thingy with a 2 year old DBD::SQLite, but
test results show that you need the 6 month old version not to get test failures.
Install the new DBD::SQLite? [Y/n]</p></li>
</ul>

<p>I should reiterate that CPAN clients are doing the right thing already with regards to the relevant standards. But it can be useful to also account for the human factor.</p>

<p><strong>Update:</strong> chromatic pointed out <a href="http://www.modernperlbooks.com/mt/2010/10/version-dependencies-dont-guess.html">on the Modern Perl Books</a> blog that you could set the recommended minimum version to whatever the developer happened to have installed when testing the module (and I'm replying here since it seems that his OpenID method is broken).</p>

<p>I think that alternative is probably the worst of the lot, some CPAN authors do that and it causes all sorts of problems for people using downstream distributors of the CPAN.</p>

<p>For example if you develop on v5.13.5 as I do, and depend on <code>Test::More</code> you'd implicitly depend on version 0.97_01 using this method. Even though the 0.92 version included with perl v5.10.1 would probably do just fine.</p>

<p>By depending on the latest version someone trying to use your program with Debian, RHEL or other third-party package systems will run into problems. Uers show up on IRC all the time with this problem, and more often than not the answer is "ignore the prerequisite versions, your old module will work just fine". At best they're using the CPAN directly, and will have to needlessly upgrade &amp; test a lot of their dependencies.</p>

<p>Adding automatic soft dependencies <a href="http://www.modernperlbooks.com/mt/2010/10/version-dependencies-dont-guess.html#comment-591">as one commenter points out</a> would probably be more useful.</p>

<p>But either solution would require awareness and diligence by CPAN authors, and new releases of the offending distros. Given the human factor of this problem a change in the CPAN clients would probably work better, and would trickle down to existing releases.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Let&apos;s add Git userdiff defaults for Perl and Perl 6</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/08/lets-add-git-userdiff-defaults-for-perl-and-perl-6.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.901</id>

    <published>2010-08-15T13:19:07Z</published>
    <updated>2010-08-15T14:03:51Z</updated>

    <summary>Git allows you to define a custom hunk-header which&apos;ll be used by git diff as the context line in diff hunks. Git includes presets for several languages but no presets for Perl and Perl 6. I&apos;d like to change that. If you have no idea what these are, consider a file that contains this code: sub foo { my $x...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="Git" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Perl" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="diff" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="diff" label="diff" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="Git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="Perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Git allows you to <a href="http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html#_defining_a_custom_hunk_header">define a custom
hunk-header</a>
which'll be used by <code>git diff</code> as the context line in diff
hunks. Git includes presets <a href="http://github.com/git/git/blob/master/userdiff.c#L13">for several
languages</a>
but no presets for Perl and Perl 6. I'd like to change that.</p>

<p>If you have no idea what these are, consider a file that contains
this code:</p>

<pre><code>sub foo {
    my $x = "a";
    my $y = "b";
    my $z = "c";
    my $poem = &lt;&lt;"POEM";
This is a
Long string
In a heredoc
POEM
    I'm::On::A::Horse();
}
</code></pre>

<p>Now, if you change the last statement in that subroutine to
something more clever and run <code>git diff</code> you'll get this:</p>

<pre><code>diff --git a/file.pl b/file.pl
index 7ed4207..ffb1ff9 100644
--- a/file.pl
+++ b/file.pl
@@ -7,5 +7,5 @@ This is a
 Long string
 In a heredoc
 POEM
-    I'm::On::A::Horse();
+    The::Tickets::Are::Now::Diamonds();
 }
</code></pre>

<p>In that diff this is the context line:</p>

<pre><code>@@ -7,5 +7,5 @@ This is a
</code></pre>

<p>Having "This is a" there doesn't provide very useful context, but that
can be changed with userdiff, just add this to <code>.gitattributes</code>:</p>

<pre><code>*.pl diff=perl
</code></pre>

<p>And this to .git/config:</p>

<pre><code>[diff "perl"]
      xfuncname = "^\\s*(sub.*)"
</code></pre>

<p>And the hunk context is now more useful, and shows the name of
the subroutine that's being changed:</p>

<pre><code>@@ -7,5 +7,5 @@ sub foo {
</code></pre>

<p>I'd like to extend the Git defaults to include Perl, but I'm
probably forgetting some cases where something is subroutine-ish
that doesn't match simply <code>"\\s*(sub.*)"</code>. Other cases I can think of are:</p>

<ul>
<li>The package statement</li>
<li>my $x = sub { ... } (needs a complex regex to match `my/our <varname> ...)</li>
<li>The BEGIN/INIT/END etc. routines</li>
<li>Maybe "method ..." from MooseX::Declare and friends? It
shouldn't hurt to include this</li>
<li>Something else?</li>
</ul>

<p>Then there's the issue of Perl 6. I'm completely unfamiliar with
it, but I can add it while I'm at it if I'm given some examples.</p>

<p>The userdiff facility also has support for defining a "word" for the
<a href="http://www.kernel.org/pub/software/scm/git/docs/git-diff.html">--word-diff</a>
option to <code>git diff</code>. I don't use this option, but I wouldn't be
surprised if it did the wrong thing for Perl code.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Why you should scrape HTML with regexes</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/06/why-you-should-scrape-html-with-regexes.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.647</id>

    <published>2010-06-17T21:44:02Z</published>
    <updated>2010-06-17T22:05:23Z</updated>

    <summary><![CDATA[I used to always scrape little bits of HTML properly, but I rarely bother anymore. I wrote this little bit of code today because I didn't find something on CPAN to do it. That is, nothing that didn't require authentication like Net::Twitter: when (m[//twitter\.com/(?&lt;user&gt;[^/]+)/status/(?&lt;id&gt;\d+)]) { require LWP::Simple; LWP::Simple-&gt;import; my $user = $+{user}; if (my $content = get($ARGV[0])) { my ($when)...]]></summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="URI::Title" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="html" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="regex" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="scraping" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="twitter" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="flamebait" label="flamebait" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="html" label="html" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="regex" label="regex" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="scraping" label="scraping" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="twitter" label="twitter" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="urititle" label="URI::Title" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I used to always scrape little bits of HTML <a href="http://search.cpan.org/perldoc?HTML::TreeBuilder">properly</a>, but I rarely bother anymore. I <a href="http://github.com/hinrik/failo/commit/bd1102d978309020e01304cc4619d90d041191ef">wrote this</a> little bit of code today because I didn't find something on CPAN to do it. That is, nothing that didn't require authentication like <a href="http://search.cpan.org/perldoc?Net::Twitter">Net::Twitter</a>:</p>

<pre><code>when (m[//twitter\.com/(?&lt;user&gt;[^/]+)/status/(?&lt;id&gt;\d+)]) {
    require LWP::Simple;
    LWP::Simple-&gt;import;
    my $user = $+{user};
    if (my $content = get($ARGV[0])) {
        my ($when) = $content =~ m[&lt;span class="published timestamp"[^&gt;]+&gt;(.*?)&lt;/span&gt;];
        my ($twat) = $content =~ m[&lt;meta content="(?&lt;tweet&gt;.*?)" name="description" /&gt;];
        if ($when and $twat) {
            say "Twat by $user $when: $twat";
</code></pre>

<p>It prints the full contents of a tweet to IRC given a URL, <a href="http://github.com/hinrik/failo/blob/master/lib/Failo/URITitle.pm#L10">here's the</a> full program.</p>

<p>In a previous life I'd have used <code>HTML::TreeBuilder</code>, but after I actually wrote a bunch of <em>simple</em> scraping programs I found that I was wasting my time. Proper HTML parsing where you're extracting the value of a tag given a <code>class</code> breaks just as hard when the other side completely changes their HTML layout.</p>

<p>That's what they usually end up doing in my experience. I've rewritten the guts of <code>POE::Component::IRC::Plugin::ImageMirror</code>'s <code>_mirror_imgshack</code> at least 5 times now, none of which would have been helped with a proper parser.</p>

<p>Of course I'd use a proper parser for something like getting the nth element of a table, I'm not crazy. I just can't be bothered for something simple like the above.</p>

<p>Don't be afraid to use powertools, but don't be afraid to use the incorrect and stupid version whose API you don't have to figure out all over again when stuff breaks unexpectedly either.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>How I setup my Debian server to run perl 5.13.1 with perlbrew</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/06/how-i-setup-my-debian-server-to-run-perl-5131-with-perlbrew.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.634</id>

    <published>2010-06-11T21:49:56Z</published>
    <updated>2010-06-11T22:26:46Z</updated>

    <summary>In May I decided to stop using Debian&apos;s perl 5.10.1 in favor of using a 5.13.1 built with perlbrew, and CPAN modules built with cpanminus. It&apos;s been great, here&apos;s how I did it. Before switching over I ignored Debian&apos;s perl library packages, and installed everything with cpanm into /usr/local. But since I wanted to use the new post-5.10 features of...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="5.12" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="5.13" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Debian" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Git" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="cpanm" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perlbrew" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="512" label="5.12" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="513" label="5.13" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cpanm" label="cpanm" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="debian" label="Debian" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perlbrew" label="perlbrew" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>In May I decided to stop using Debian's perl 5.10.1 in favor of using a 5.13.1 built with perlbrew, and CPAN modules built with cpanminus. It's been great, here's how I did it.</p>

<p>Before switching over I ignored Debian's perl library packages, and installed everything with <code>cpanm</code> into <code>/usr/local</code>. But since I wanted to use the new post-5.10 features of Perl I thought I might as well replace all of it and use a newer perl.</p>

<p>What I did:</p>

<ul>
<li>Created a <code>v-perlbrew</code> user. All users on the server can use this centrally managed Perl and its modules</li>
<li>Added this to everyone's <code>.bashrc</code>: <code>test -f ~/perl5/perlbrew/etc/bashrc &amp;&amp; source ~/perl5/perlbrew/etc/bashrc</code></li>
<li>Made <a href="http://github.com/avar/linode-etc/blob/master/users/v-perlbrew/cpan-modules">a list of CPAN modules</a> that I need. When I upgrade the perlbrew perl I can just run <code>grep -v ^# cpan-modules | cpanm</code> to get all the required modules with the new perl.</li>
<li>Ran around changing <code>PATH</code> in crontabs, Apache settings etc. so that everything that isn't internal to Debian itself uses perlbrew's perl instead of <code>/usr/bin/perl</code>.</li>
</ul>

<p>Getting the PATHs right everywhere turned out to be the hardest part. A lot of things in Debian have a path like <code>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin</code>. I haven't found out how to change that, presumably some of them are hardcoded into executables like bash.</p>

<p>To get around that I have to hardcode the <code>PATH</code> to perlbrew <a href="http://gist.github.com/435115">in every crontab</a> that uses perl. For a full list of these and other changes I've made the output of <code>git --git-dir /etc/.git log -p --reverse -Sperlbrew</code> <a href="http://gist.github.com/435103">available as a Gist</a>.</p>

<p>The only caveat I've encountered is that there's one global perlbrew bashrc in <code>~/perl5/perlbrew/etc/bashrc</code>. So if I can't use <code>perlbrew switch</code> to only switch some users onto a given perl. It would be neat if perlbrew supported having the <code>current</code> symlinks in a local <code>~/perl5</code> while the actual binaries and modules were in <code>~v-perlbrew/perl5</code>.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Check out Devel::NYTProf 4.00</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/06/check-out-develnytprof-400.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.629</id>

    <published>2010-06-09T22:45:48Z</published>
    <updated>2010-06-10T15:00:04Z</updated>

    <summary>Tim Bunce&apos;s Devel::NYTProf has a bunch of improvements in version 4.00, which was released yesterday. The compatibility problem with Devel::Declare code like Module::Signatures::Simple that I previously blogged about has been fixed. It can now profile inside string evals, and more. Update: Tim Bunce now has a posting about NYTProf 4.00 on his blog....</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="advocacy" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="benchmark" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="benchmark" label="benchmark" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="develnytprof" label="Devel::NYTProf" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="hailo" label="Hailo" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="methodsignaturessimple" label="Method::Signatures::Simple" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="profiling" label="profiling" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Tim Bunce's Devel::NYTProf has <a href="http://search.cpan.org/~timb/Devel-NYTProf-4.00/Changes#Changes_in_Devel::NYTProf_4.00_(svn_1291)_8th_June_2010">a bunch of improvements</a> in version 4.00, which was released yesterday.</p>

<p>The compatibility problem with Devel::Declare code like Module::Signatures::Simple <a href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/05/trying-out-methodsignaturessimple.html">that I previously blogged about</a> has been fixed. It can now profile inside string evals, and more.</p>

<p><em>Update</em>: Tim Bunce now has <a href="http://blog.timbunce.org/2010/06/09/nytprof-v4-now-with-string-eval-x-ray-vision/">a posting</a> about NYTProf 4.00 on his blog.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Adding gettext support to Git</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/06/adding-gettext-support-to-git.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.604</id>

    <published>2010-06-02T22:58:54Z</published>
    <updated>2010-06-02T23:12:29Z</updated>

    <summary>I have an RFC patch series to Git to add gettext localization support to it. So that eventually you&apos;ll be able to configure Git to e.g. shout error messages at you in German. Won&apos;t that be a nice variant of the current abuse? I think so. Here&apos;s the latest version of the patch series I posted to the Git mailing...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="5.14" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Git" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="core" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="i18n" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="l10n" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="git" label="Git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="github" label="GitHub" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="i18n" label="i18n" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="l10n" label="l10n" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="localization" label="localization" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I have <a href="http://github.com/avar/git/compare/master...topic/git-gettext">an RFC patch series</a> to Git to add gettext localization support to it. So that eventually you'll be able to configure Git to e.g. shout error messages at you in German. Won't that be a nice variant of the current abuse? I think so.</p>

<p><a href="http://marc.info/?l=git&amp;m=127551805224392&amp;w=2">Here's</a> the latest version of the patch series I posted to the Git mailing list.</p>

<p>For the Perl side of things (Git is partially implemented in Perl) I'm using <a href="http://search.cpan.org/perldoc?Locale::Messages">libintl-perl's Locale::Messages</a>. It was very pleasant  to work with it. I wonder why more Perl projects don't use it instead of Perl-y libraries like <a href="http://search.cpan.org/perldoc?Locale::Maketext">Locale::Maketext</a>.</p>

<p>Maybe it's just the GNU gettext dependency they're trying to get rid of, although <code>libintl-perl</code> includes a Pure-Perl version of the tools it provides <code>.mo</code>, so probably not.</p>

<p>Actually the way most open source projects do localization is "not at all". I don't blame them, I certainly can't be bothered most of the time. But I wonder to what degree we're losing potential users &amp; contributors because of this.</p>

<p>There was a recent-ish study of social networks on GitHub where it was evident that a lot of Japanese Perl users had formed a social-ghetto amongst themselves. I've seen a few trending Perl repositories that only have <code>README</code> files in Japanese.</p>

<p>Maybe better localization tools - and most of all - a commitment to use them would help to bridge some of that.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Trying out Method::Signatures::Simple</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/05/trying-out-methodsignaturessimple.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.592</id>

    <published>2010-05-27T22:18:40Z</published>
    <updated>2010-05-28T14:54:12Z</updated>

    <summary>I previously wrote about trying out MooseX::Method::Signatures. That module is neat, but incurs a significant runtime penalty per subroutine call. Now I&apos;ve tested out Method::Signatures::Simple. It&apos;s powered by Devel::Declare and doesn&apos;t seem to incur a any runtime penalty. However, since it needs to do some work when the subroutines are compiled, there&apos;s a 3-4% compilation hit for my tests: But...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="Hailo" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="benchmark" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="benchmark" label="benchmark" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="develnytprof" label="Devel::NYTProf" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="hailo" label="Hailo" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="methodsignaturessimple" label="Method::Signatures::Simple" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>I previously <a href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/02/moosexmethodsignatures-is-really-slow.html">wrote about</a> trying out <a href="http://search.cpan.org/perldoc?MooseX::Method::Signatures">MooseX::Method::Signatures</a>. That module is neat, but incurs a significant runtime penalty per subroutine call.</p>

<p>Now I've tested out <a href="http://search.cpan.org/perldoc?Method::Signatures::Simple">Method::Signatures::Simple</a>. It's powered by <a href="http://search.cpan.org/perldoc?Devel::Declare">Devel::Declare</a> and doesn't seem to incur a any runtime penalty. However, since it needs to do some work when the subroutines are compiled, there's a 3-4% compilation hit for my tests:</p>

<script src="http://gist.github.com/416451.js?file=plain-hailo-vs-mss.txt"></script>

<p>But on runtime there's no hit at all:</p>

<script src="http://gist.github.com/417242.js?file=plain-hailo-vs-mss-runtime.txt"></script>

<p><a href="http://github.com/avar/hailo/compare/master...feature/method-signatures-simple">Here's</a> what I needed to do to convert Hailo to it. Unfortunately using it breaks interaction with <a href="http://search.cpan.org/perldoc?Devel::NYTProf">Devel::NYTProf</a>. When I generate profiling output with <code>nytprofhtml</code> what were previously links to my subroutines aren't links at all.</p>

<p>That's a big price to pay for just turning this:</p>

<script src="http://gist.github.com/416458.js?file=plain-perl.pl"></script>

<p>Into this:</p>

<script src="http://gist.github.com/416461.js?file=mss-perl.pl"></script>

<p>So unless I can figure out a workaround for that I won't be merging that branch.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>New unrestricted license for Perl software</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/05/new-unrestricted-license-for-perl-software.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.524</id>

    <published>2010-05-04T21:52:34Z</published>
    <updated>2010-05-04T22:11:44Z</updated>

    <summary>Since someone saw fit to write a Wikipedia article about my DWTFYWWI license, I thought I&apos;d write a Software::Licence module for it. Now you can specify license = DWTFYWWI in Dist::Zilla, and anything else that uses Software::License. It&apos;s the first Software::License::* not in the core Software::License distribution (RJBS refused my patch to integrate it). It might not be for long,...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
    <category term="dwtfywwi" label="DWTFYWWI" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Since someone saw fit to write <a href="http://en.wikipedia.org/wiki/DWTFYWWI">a Wikipedia article</a> about my <a href="http://github.com/avar/DWTFYWWI">DWTFYWWI</a> license, I thought I'd <a href="http://search.cpan.org/perldoc?Software::License::DWTFYWWI">write a Software::Licence</a> module for it. Now you can specify <code>license = DWTFYWWI</code> in <a href="http://search.cpan.org/perldoc?Dist::Zilla">Dist::Zilla</a>, and anything else that uses <a href="http://search.cpan.org/perldoc?Software::License">Software::License</a>.</p>

<p>It's the first <code>Software::License::*</code> not in the core <code>Software::License</code> distribution (RJBS refused <a href="http://github.com/avar/software-license/commit/e9859049eb50c7c57bcebabe92e103a35f18ad25">my patch</a> to integrate it). It might not be for long, FLORA has threatened to release WTFPL support.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>The first new feature in Perl 5.14</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/04/the-first-new-feature-in-perl-514.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.486</id>

    <published>2010-04-15T18:46:38Z</published>
    <updated>2010-04-15T18:51:08Z</updated>

    <summary>Since 5.12 got released a lot of bugfixes have been flowing into blead and one new feature. The prctl() support for $0 that I previously blogged about just got commited by Steffen Mueller. With this patch you can finally killall programs you write in perl on Linux without killing all of your perl processes indiscriminately....</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="5.12" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="5.14" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="core" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="512" label="5.12" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="514" label="5.14" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="core" label="core" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="prctl" label="prctl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Since <a href="http://dev.perl.org/perl5/news/2010/perl-5.12.0.html">5.12 got released</a> a lot of bugfixes have been flowing into <code>blead</code> and <a href="http://perl5.git.perl.org/perl.git/commit/7636ea95c57762930accf4358f7c0c2dec086b5e">one new feature</a>. The <code>prctl()</code> support for <code>$0</code> that I <a href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/03/what-happens-when-you-assign-to-0.html">previously blogged about</a> just got commited by Steffen Mueller.</p>

<p>With this patch you can finally <code>killall</code> programs you write in perl on Linux without killing all of your perl processes indiscriminately.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Help make Perl 5.12 better by testing perl-5.12.0-RC3</title>
    <link rel="alternate" type="text/html" href="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/2010/04/help-make-perl-512-better-by-testing-perl-5120-rc3.html" />
    <id>tag:blogs.perl.org,2010:/users/aevar_arnfjor_bjarmason//204.433</id>

    <published>2010-04-03T10:40:53Z</published>
    <updated>2010-04-03T12:12:27Z</updated>

    <summary>Jesse Vincent uploaded the perl-5.12.0-RC3 release to the CPAN. It&apos;s important that that this release is tested to flag any potential release blockers. If none are found it&apos;ll be released as 5.12 on April 9. Here&apos;s how you can do that: All tests should have been successful. To install it (without touching your existing perl!) do: Now you have an...</summary>
    <author>
        <name>Ævar Arnfjörð Bjarmason</name>
        <uri>http://xn--var-xla.net</uri>
    </author>
    
        <category term="5.12" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="core" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="512" label="5.12" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="core" label="core" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://blogs.perl.org/users/aevar_arnfjor_bjarmason/">
        <![CDATA[<p>Jesse Vincent <a href="http://www.nntp.perl.org/group/perl.perl5.porters/2010/04/msg158346.html">uploaded</a> the <a href="http://search.cpan.org/dist/perl-5.12.0-RC3/">perl-5.12.0-RC3</a> release to the CPAN. It's important that that this release is tested to flag any potential release blockers. If none are found it'll be released as 5.12 on April 9.</p>

<p>Here's how you can do that:</p>

<script src="http://gist.github.com/354367.js"></script>

<p>All tests should have been successful. To install it (without touching your existing perl!) do:</p>

<script src="http://gist.github.com/354402.js?file=perl5-rc3-install.sh"></script>

<p>Now you have an installed <code>perl-5.12.0-RC3</code> in <code>~/perl5-rc3/installed/bin/perl</code>. Now just configure CPAN to install modules without nagging:</p>

<script src="http://gist.github.com/354405.js?file=perl5-rc3-cpan.sh"></script>

<p>And then maybe try installing your favorite CPAN modules, or bundles that suck down a lot of them (using <code>sudo</code> here because my <code>~/.cpan</code> is owned by root):</p>

<script src="http://gist.github.com/354425.js?file=perl5-rc3-cpan-modules.sh"></script>

<p>Of course the most useful think you can do is test it on your own in-house code. All the code on the CPAN has probably been tested with 5.12 already.</p>

<p>If you encounter any issues first check if they're listed in <a href="http://dev.perl.org/perl5/errata.html">the errata</a> or mentioned in the <a href="http://search.cpan.org/dist/perl-5.12.0-RC3/pod/perl5120delta.pod">perldelta for 5.12</a>.</p>

<p>if you think you've found a new bug please report it with the <a href="http://perldoc.perl.org/perlbug.html">perlbug</a> tool installed with perl-5.12.0-RC3.</p>
]]>
        

    </content>
</entry>

</feed>
