<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Hacking Thy Fearful Symmetry</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/" />
    <link rel="self" type="application/atom+xml" href="http://babyl.dyndns.org/techblog/atom.xml" />
    <id>tag:babyl.dyndns.org,2008-09-29:/techblog//1</id>
    <updated>2009-10-30T00:33:47Z</updated>
    <subtitle>Yanick opens mouth, technobabble ensues.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.25</generator>

<entry>
    <title>Perl Module Dependencies: how to require the latest, and nothing less</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/10/perl-module-dependencies-how-to-require-the-latest-and-nothing-less.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.171</id>

    <published>2009-10-14T23:27:35Z</published>
    <updated>2009-10-30T00:33:47Z</updated>

    <summary>entry originally published on the Pythian blog. Recently, hanekomu was contemplating how to make subsequent installs of a Task::BeLike module upgrade its dependencies to their latest version. The idea is intriguing. It&#8217;s not something you want to do for a...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="taskbelike" label="Task::BeLike" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="taskbelikeyanick" label="Task::BeLike::YANICK" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="dependencies" label="dependencies" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="hanekomu" label="hanekomu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modules" label="modules" 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://babyl.dyndns.org/techblog/">
        <![CDATA[<p><i>entry originally published on the <a href="http://www.pythian.com/news/4281/perl-module-dependencies-how-to-require-the-latest">Pythian blog</a>.
</i></p>

				<p>Recently, hanekomu was contemplating <a href="http://hanekomu.at/blog/dev/20091005-1227-repeatedly_installing_task_distributions.html">how to make subsequent installs of a <em>Task::BeLike</em> module upgrade its dependencies to their latest version</a>.</p>
<p>The idea is intriguing.  It&#8217;s not something you want to do for a typical module, but it makes sense in the context of <em>Task::BeLike</em>. If you care enough about a module to put it in your <em>Task::BeLike</em>, you probably care enough to want to upgrade when there&#8217;s a new version out there.</p>
<p>Alas, I think hanekomu&#8217;s proposed way of doing it is flawed (mind you, the debate is still going on as of the writing of this entry, and I can very well still be proven wrong).  But after some pondeferous chin scratching, I might have come with a cunning alternative to it.</p>

<p><span id="more-4281"></span></p>
<p>Let&#8217;s say that in your <code>Build.PL</code> (the logic would be the same for a <code>Makefile.PL</code>) you have your dependencies stashed in <em>%dependencies</em>.  Something akin to:</p>
<pre><code>%dependencies = (
    XML::LibXML      =&gt; 0,          # any version will do
    XML::XPathScript =&gt; '1.42',     # 1.42 or higher
    Moose            =&gt; 'latest',   # nothing but the shiniest!
);

</code></pre>
<p>All we want to do, really, is to switch the <em>latest</em> for, well, the latest version available.  Surprisingly, that something that is almost as easy to do than to say:</p>
<pre><code>for my $mod ( keys %dependencies ) {
    next unless $dependencies{$mod} eq 'latest';

    require CPANPLUS::Backend;
    state $cb = CPANPLUS::Backend-&gt;new;

    $dependencies{$mod} = $cb-&gt;module_tree( $mod )-&gt;package_version;
}
</code></pre>
<p>Yes, that&#8217;s really all there is to it. A <a href="http://github.com/yanick/Task-BeLike-YANICK/commit/563898785d5a39af66c6d5ad3a296dfb7568bb3e">little further hacking</a> later, I have incorporated the functionality to my own <em>Task::BeLike::YANICK</em> module.  The way I implemented it, installing the module the usual way will yield no surprise (i.e., dependencies already present are not going to be updated).  But if the environment variable <code>TASK_UPGRADE</code> is set to true, like so:</p>

<pre><code>TASK_UPGRADE=1 cpan -f Task::BeLike::YANICK</code></pre>
<p>&nbsp;.&nbsp;.&nbsp;.&nbsp;then the magic is going to be unleashed (the <code>-f</code> is to force the re-install, if the Task has already been installed before).</p>
<p>Alternatively, just to know which dependencies are out-of-date, one can also extract the distribution and do a</p>
<pre><code>perl ./Build.PL --upgrade
./Build prereq_report
</code></pre>
]]>
        
    </content>
</entry>

<entry>
    <title>The Joy of Finding Your Code in Unexpected Places</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/10/the-joy-of-finding-your-code-in-unexpected-places.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.170</id>

    <published>2009-10-08T23:21:16Z</published>
    <updated>2009-10-30T00:32:56Z</updated>

    <summary>entry originally published on the Pythian blog. picture by Geophaps Hey, that one in the sixth row&#8230; Doesn&#8217;t he looks familiar? So there I am, on my morning bus ride, reading my copy of The Definitive Guide to Catalyst (keep...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="catalyst" label="Catalyst" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="git" label="Git" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="vcs" label="VCS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="blogging" label="blogging" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="book" label="book" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="development" label="development" 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://babyl.dyndns.org/techblog/">
        <![CDATA[<p><i>entry originally published on the <a href="http://www.pythian.com/news/4238/the-joy-of-finding-your-code-in-unexpected-places">Pythian blog</a>.
</i></p>

				<div style="float:right;margin-left:30px;width:250"><img src="http://babyl.dyndns.org/misc/penguin_small.jpg" alt="Lotsa penguins" width="250" height="150" /></p>
<p>picture by <a href="http://www.flickr.com/photos/31525296@N06/">Geophaps</a><br />
<em>Hey, that one in the sixth row&#8230;<br /> Doesn&#8217;t he looks familiar?</em></div>
<p>So there I am, on my morning bus ride, reading my copy of <a href="http://www.apress.com/book/view/1430223650">The Definitive Guide to Catalyst</a> (keep your eyes peeled for the upcoming review of the book in <a href="http://theperlreview.com/">the Perl Review</a>).</p>

<p>I&#8217;m near the end, in Chapter 11, <em>Catalyst Cookbook</em>.  As it is with most tech books, the last chapters are the most engrossing, as the gloves finally come of and the writers throw at you all the wonderful, mind-bending stuff that the rest of the book prepares you for.</p>
<p>The section I&#8217;m at is about the development process.  Specifically, it shows how you can put hooks in your versioning system to automatically screen commits to conform to Perl::Critic and Perl::Tidy policies.  The given example script uses Git, which is just dandy with me as it is my current VCS of choice.  But there&#8217;s something&nbsp;.&nbsp;.&nbsp;.&nbsp; funny about that script. The way the utility functions are stashed at the end after a</p>
<p><code>### utility functions ##############################</code></p>
<p>line.  The choice of variable names. The comments.  It all feels oddly familiar. <span id="more-4238"></span> And then my eyes fall on the line</p>

<p><code>exit 0 unless @dirty;     # Alles gut</code></p>
<p>and <a href="http://use.perl.org/~Yanick/journal/35626">everything falls into place</a>.  The script in the book is a wee bit different and has been improved upon, but its origin is unmistakable. Somehow, unexpectedly, a hack of mine found its way into publication.  Fame, glory, and page 293 of the Catalyst book, I can finally claim &#8216;em all as rightfully mine!</p>
<p>But, serendipitous glee aside, three important lessons lie in this little story.</p>
<h3>1. Blog posts, great and small, the Perl Gestalt, it reads them all</h3>
<p>All clever tricks, code snippets, and insights you come up with?  Blog &#8216;em. Even if you think they are only an itsy widdly little bit clever.  Chances are, if there is a spark in there, it&#8217;ll ignite the mind of someone insaner than you are and ultimately result in something awe-inspiring.  Or, more importantly, something awe-inspiring for which you&#8217;ll have bragging rights.</p>
<p>And don&#8217;t despair if your blog entries mostly go without comments.  Provided that you are broadcast by an <a href="http://perlsphere.net/">aggregator</a> or <a href="http://ironman.enlightenedperl.org/">two</a>, people <em>will</em> read you.  Silently, furtively, your thoughts <em>will</em> slip in the Perl subconscious like so many pumpkin seeds into autumn soil.</p>

<h3>2. Code carries your DNA</h3>
<p>No big discovery here, but it&#8217;s interesting to see how surprisingly easy it is to recognize one&#8217;s own code.  One would think that nothing looks more like a line of code than another line of code, the same way nothing looks more like a baby emperor penguin than another one.</p>
<p>Yet, we do recognize ours by a curve of the beak, a specific timbre of the voice. Admittedly, Perl&#8217;s flexibility provides much more latitude for transposing our idiosyncrasies unto our digital babies.  But then again, isn&#8217;t why a lot of us love Perl so much?</p>
<h3>3. Some of my code made it into a Catalyst book!</h3>
<p>I mean, seriously, how terminally cool is that?!</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Gaining My Money Where My Mouth Is</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/08/gaining-my-money-where-my-mouth-is.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.169</id>

    <published>2009-08-23T17:46:41Z</published>
    <updated>2009-08-23T18:03:22Z</updated>

    <summary> In the last three months, I&apos;ve been eerily quiet both on my blog (it&apos;s been so long, I&apos;m afraid I&apos;m going to bolt straight past Paper Man and end up Pulp Man) and on the module front. Ironically enough,...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://babyl.dyndns.org/techblog/rubicon.jpg"><img alt="rubicon.jpg" src="http://babyl.dyndns.org/techblog/assets_c/2009/08/rubicon-thumb-420x331-7.jpg" width="420" height="331" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></a></span></p>

<p>In the last three months, 
I've been eerily quiet both on my
blog (it's been so long, I'm afraid
I'm going to bolt straight past 
<a href="http://ironman.enlightenedperl.org/">Paper Man</a>
and end up Pulp Man) and on the module front. 
Ironically enough, this long silence has actually 
been
caused by events in my life that have Perl plastered
all over them.</p>

<p>In a nutshell, after 11 years of working in the telecom
industry, I've decided
to take the plunge and try something different.  As of
the end of July, I've switched allegiance to 
<a href="http://www.pythian.com/">The Pythian Group</a>. 
They are a company specializing in database support,
and they happen to use Perl-based internal tools.  Which is 
where, as the astute reader may surmise, I enter the picture.  </p>

<p>So, no more watching from the peanut gallery for li'll old me -- we'll now
see if I can make a living out of that Perl stuff.  </p>

<p>No need to say, I'm in equal part thrilled, exhilarated and terrified of what lies ahead. 
Hopefully, my new colleagues will feel the same way before long. :-)</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Moose and Daemons, now on video!</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/05/moose-and-daemons-now-on-video.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.168</id>

    <published>2009-05-31T17:49:56Z</published>
    <updated>2009-05-31T17:56:49Z</updated>

    <summary>The talks of the last perl Monger meeting are now available online for your viewing pleasure. In addition of the classic decks of slides, thanks to Andrew Ross of the FOSSLC we also have full-fledged recordings of the talks: Tim...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="moose" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="ottawa Perl mongers" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p>The talks of the last perl Monger meeting are now available online for your viewing pleasure. In addition of the classic decks of slides, thanks to Andrew Ross of the <a href="http://www.fosslc.org">FOSSLC</a> we also have full-fledged recordings of the talks:</p>

<ul>
<li><p><a href="http://www.pythian.com/news/2575/perl-moose-and-daemons">Tim Procter</a>'s ''Portable Perl Daemons'': 
<a href="http://hosting3.epresence.tv/fosslc/1/watch/149.aspx">audio-visual extravaganza</a> or <a href="http://babyl.dyndns.org/techblog/2009/05/31/daemons.pdf">just the slides</a>.</p></li>
<li><p>Your truly introduction to Moose: 
<a href="http://hosting3.epresence.tv/fosslc/1/watch/148.aspx">audio-visual extravaganza</a> or <a href="http://babyl.dyndns.org/perl/moose-mongers/">just the slides</a>.</p></li>
</ul>

<p>Enjoy!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Ottawa Mongers: Moose &amp; Daemons</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/05/ottawa-mongers-moose-daemons.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.167</id>

    <published>2009-05-23T15:24:10Z</published>
    <updated>2009-05-23T15:37:06Z</updated>

    <summary> The Ottawa Mongers meet this month! On the program, we have a Monger special edition of the Moose talk I gave at the FOSSLC Summercamp last week, and Tim Procter of the Pythian Group will give a talk about...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="ottawa Perl mongers" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="Moose and Daemons poster" src="http://babyl.dyndns.org/techblog/2009/05/23/moose-and-daemons.jpg" width="520" height="410" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span>

<p>The Ottawa Mongers meet this month! </p>
<p>
On the program,
we have a Monger special edition of the Moose talk I gave at the 
<a href="http://fosslc.org/drupal/summercamp2009">FOSSLC Summercamp</a>
last week, and Tim Procter of the 
<a href="http://www.pythian.com">Pythian Group</a> 
will give a talk about Perl Daemon Processes.</p>

<p><b>Location and Time</b></p>
<p>
The meeting will take place Tuesday May 26<sup>th</sup>, at 7:00pm.
We'll be at the <a href="http://maps.google.ca/maps?hl=en&safe=off&client=firefox-a&q=116+albert+street+Ottawa&ie=UTF8&split=0&gl=ca&ei=rAcYSuyeNIieMqmKvY8P&t=h&z=16&iwloc=A">Pythian Group office</a> (Suite 1000, 116 Albert Street).</p>
<p>
If you plan to
come, please let me know so that we make sure we can accommodate
everyone.</p>]]>
        
    </content>
</entry>

<entry>
    <title>To 5.10 or not to 5.10</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/05/to-510-or-not-to-510.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.166</id>

    <published>2009-05-18T01:27:04Z</published>
    <updated>2009-05-18T01:33:30Z</updated>

    <summary>Ever since Perl 5.10 came out, my soul is torn asunder by a particularly prickly dilemma. On one hand, my love of shiny new toys urge me to go forth and use the new features of 5.10 to their full...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p>Ever since Perl 5.10 came out, my soul is torn asunder by a particularly prickly dilemma. </p>

<p>On one hand, my love of shiny new toys urge me to go forth and use the new features of 5.10 to their full extent so that my code is clean, concise and, most important of all, spiffy.  </p>

<p>On the other hand, my insatiable thirst for glory dictates that 
I should strive to make my modules accessible to the widest range
of configurations possible.  In that light, setting the
requirement bar to Perl 5.10 is a severe drawback.  Kinda
like longing for world domination, but restricting oneself 
to invade only countries with names beginning with 'M'. </p>

<p>So far I pretty much went the 5.8-compatible way. But the call of the shiny
is becoming just too strong, and from now on I'll try a new approach.</p>

<p>Conceptually, I'll divide my modules into two categories: modules that are 
for general consumption (WWW::Ohloh::API, XML::XPathScript, etc),
and modules that are tools for developers (Dist::Release, 
Git::CPAN::Patching, Test::Pod::Snippets). <br />
The formers, I'll keep 5.8-compatible.  For the latter, though,
I'll go on a limb and assume that they'll be used on development
machines.  Machines that can afford -- nay, should be expected --
to have a Perl 5.10 binary stashed somewhere.  </p>

<p>Now, my only hope is that by doing so I'll not alienate my user base. 
Well, not exactly: I also hope there is actually a user base to alienate in the first place.  :-)</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Me, Moose and Summercamp 2009  </title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/05/me-moose-and-summercamp-2009.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.165</id>

    <published>2009-05-10T23:49:28Z</published>
    <updated>2009-05-11T00:13:51Z</updated>

    <summary>(by the by, I joined the fun and accepted the Perl Iron Man Challenge.) As assiduous readers of my blog may recall, last year I gave a 35 minutes Perl introduction at OSBootCamp 8. For unphantomable reasons, I&apos;ve been asked...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="moose" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p>(by the by, I joined the fun and accepted
the <a href="http://www.shadowcat.co.uk/blog/matt-s-trout/iron-man/">Perl Iron Man
Challenge</a>.)</p>

<p>As assiduous readers of my blog may recall, last year I gave a 
<a href="http://babyl.dyndns.org/techblog/2008/09/me-at-osbootcamp-8-4.html">35 minutes Perl introduction at OSBootCamp
8</a>.  For unphantomable reasons, I've been asked to
come back and recidive for
<a href="http://fosslc.org/drupal/summercamp2009">FOSSLC Summercamp
2009</a>, which is happening
on the 13, 14 and 15 of May. </p>

<p>This time, my talk is going to be an introduction to Moose.  Why Moose? 
Since my goal is to hook unsuspecting students on Perl, I figured the easiest way to tip them to the dark side would be to show those java-tainted young minds the latest and shiniest OO coolness that the Perl community has to offer.</p>

<p>Sorry, what? ... Didn't I mention in a previous blog entry that I <a href="http://babyl.dyndns.org/techblog/2008/07/objectinsideout-cheatsheet-4.html">prefered Object::InsideOut over Moose</a>? </p>

<p>Ah... Hum... Well, yes, true, I might have said that... (darn those assiduous readers)</p>

<p>Mind you, I still think that Object::InsideOut is a very fine module indeed,
but several things made me progressively slide in the Moose camp:</p>

<ul>
<li><p>Moose has an incredibly strong momentum in the community. <br />
Notwithstanding the fact that when
so
many bright people get excited about something, it's usually for a good
reason,  it also means that Moose development is thriving. 
And not only core development, but extensions are by now abounding. <br />
And this, for my little lazy heart, is true bliss.  The <a href="http://search.cpan.org/search?query=MooseX&amp;mode=dist">MooseX</a>
namespace is quickly growing into a mini OO-CPAN.</p></li>
<li><p>At the time, I was arguing with Yuval that I had no
need for those cute 'before' and 'after' method modifiers.
Ah! That was before I seriously tried using them...</p></li>
<li><p>Roles.  Those things are dangerously addictive.  And they do 
such a damned good job of simplifying one's code.</p></li>
<li><p>MooseX::Method::Signatures, Moose types, coercion, and the
myriad of other things that all work together to move 
the tedious bits of coding out of the way, and to fragment
the good parts into small, easy to understand/maintain pieces.</p></li>
<li><p>Meta-programming.  Pure mad scientist type of fun.  How
can I possibly resist?</p></li>
</ul>

<p>So yeah, I call on my right to change my volatile mind. Color me a new Moose adept.  And, hopefully, I'll similarly be able to color some more converts this Friday.  Wish me luck.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Moose Attribute Meta Meddling</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/05/moose-attribute-meta-meddling.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.164</id>

    <published>2009-05-02T04:47:55Z</published>
    <updated>2009-05-02T16:04:12Z</updated>

    <summary>This week I finally got a good excuse to go on and dabble with Moose meta-programming. In my WWW::Ohloh::API classes, a lot of attributes take their values from an initial xml snippet. The original, naive way those values were extracted...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="moose" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="moose" label="moose" 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://babyl.dyndns.org/techblog/">
        <![CDATA[<p>This week I finally got a good excuse to 
go on and dabble with Moose meta-programming. 
In my WWW::Ohloh::API
classes, a lot of attributes take their values from an initial xml 
snippet.  The original, naive way those values were extracted was along
the lines of:</p>

<pre><code>has xml_src =&gt; (
    is   =&gt; 'ro',
    isa =&gt; 'XML::LibXML::Node',
);

has created_at =&gt; (
    is         =&gt; 'ro', 
    lazy      =&gt; 1,
    default =&gt; sub {
        return $_[0]-&gt;xml_src-&gt;findvalue( 'created_at' );
    }
)

has sender_account_name =&gt; (
    is          =&gt; 'ro', 
    lazy      =&gt; 1,
    default =&gt; sub {
        return $_[0]-&gt;xml_src-&gt;findvalue( 'sender_account_name' );
    }
);
</code></pre>

<p>Not harrowingly horrible, but rather repetitive.  I figured out it
would be much niftier to
provide the name of the attribute holding the source xml and the
pertinent xpath, and let Moose magic take care of the rest. Something like:</p>

<pre><code>has created_at =&gt; (
    metaclass =&gt; 'XMLExtract',
    is =&gt; 'ro', 
    xml_src =&gt; 'xml_src',
    xpath =&gt; 'created_at',
)
</code></pre>

<p>Well, turns out that once one knows how, 
this is fairly easy to do: </p>

<pre><code>package XMLExtract;

use Moose;

extends 'Moose::Meta::Attribute';

has 'xml_src' =&gt; ( isa =&gt; 'Str', );

has xpath =&gt; ( isa =&gt; 'Str', );

has '+lazy' =&gt; ( default =&gt; 1 );

before '_process_options' =&gt; sub {
    my ( $class, $name, $options ) = @_;

    die "attribute '$name' in class '$class' must be lazy-evaluated\n"
    if defined $options-&gt;{lazy} and not $options-&gt;{lazy};

    my $src = $options-&gt;{xml_src} ||= 'xml_src';
    my $xpath = $options-&gt;{xpath} ||= $name;

    $options-&gt;{default} = sub {
        return $_[0]-&gt;$src-&gt;findvalue($xpath);
    };

};

1;
</code></pre>

<p>If you notice, I've set '<em>xml_src</em>' and
'<em>xpath</em>' to default to '<code>xml_src</code>' 
and the name of the current attribute,
so that the code can be further simplified to</p>

<pre><code>has xml_src =&gt; (
    is   =&gt; 'ro',
    isa =&gt; 'XML::LibXML::Node',
);

has created_at =&gt; (
    metaclass =&gt; 'XMLExtract',
    is =&gt; 'ro', 
)

has sender_account_name =&gt; (
    metaclass =&gt; 'XMLExtract',
    is =&gt; 'ro', 
);
</code></pre>

<p>Short, sweet and to the point.  Now we're talking
code I like!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Ruhr.pm: Die Meister des Psycho-Lamas</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/04/ruhrpm-die-meister-des-psycho-lamas.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.163</id>

    <published>2009-04-22T00:55:26Z</published>
    <updated>2009-04-23T23:41:51Z</updated>

    <summary>Last month, thanks to a concerted effort of German Perl Mongers[1] I was able to meet with the wonderful folks of Ruhr.pm. It turns out that not only the Ruhr-area mongers are a superlatively friendly bunch, but they have pretty...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
    <category term="mongersperl" label="mongers perl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p>Last month, thanks to a concerted effort of German Perl Mongers[1]
I was able to meet with the wonderful folks of 
<a href="http://ruhr.pm.org">Ruhr.pm</a>. </p>

<p>It turns out that not only the  Ruhr-area mongers are
a superlatively friendly bunch, but they
have pretty <a href="http://ruhr.pm.org/material.psp">cool presentations</a> too. </p>

<p>The feature presentation of the night was 
<a href="http://ruhr.pm.org/files/fuse/docshot/">Fuse mit Perl</a>, 
by Simon Wilper. After he was done, I also got treated with a
quick replay of two previous presentations dealing with image
manipulation.  <a href="http://ruhr.pm.org/files/opencv/docshot">One</a> 
was about openCV, a facial recognition software,
and its Perl interface, and the other one was about the <a href="http://ruhr.pm.org/files/imagemagick/docshot">uses of
Image::Magick</a>,
including the detailed instructions on how to create a psycho-llama.
That last bit, I daresay, was worth the trip to Germany
all by itself.  The script to create the thing is in the <a href="http://ruhr.pm.org/files/imagemagick/imagemagick-beispiele.tar.gz">presentation companion tarball</a>, check it out (well, unless you suffer from epilepsy, in which case you want to stay as far away as possible).</p>

<p>So, bottom-line: Ruhr.pm rocks big time.  If you're ever passing in the vicinity, I highly recommend paying them a visit.  :-)</p>

<p>[1] Renée Bäcker saw my use.perl.org blog entry and forwarded the
information to Ruhr.pm, Veit Wahlich -- fearless leader of the Ruhrgebiet mongers --
contacted me and arranged the details, and René Knopp was dispatched
to pick me up from the train station.  Many thanks to the whole
bunch!</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Just another Perl Ausländer </title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/03/just-another-perl-auslander.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.162</id>

    <published>2009-03-04T19:24:15Z</published>
    <updated>2009-03-04T21:04:23Z</updated>

    <summary>Ever since I&apos;ve learned about the existence of $foo - Perl Magazin, I&apos;ve been awfully curious to take a peek at it. Unfortunately, they don&apos;t ship subscriptions internationally. So I went for the obvious workaround: I hunted high and low...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
    <category term="foomagazinegermany" label="$foo magazine germany" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p>Ever since I've learned about the existence of
   <a href="http://www.perl-magazin.de/">$foo - Perl Magazin</a>, I've
   been awfully curious to take a peek at it.
   Unfortunately, they don't ship subscriptions internationally.
   So I went for the obvious workaround: I hunted high and low for
   the loveliest German lass I could find, asked her to marry me,
   and coaxed her family to get and forward me a subscription for
   the magazine as this year's Christmas gift.
   Worked like a charm.</p>

   <p>
   And it was worth it too.  The magazine is even better than
   I expected, and it's high praises to the authors that
   I  learned quite a few things from the articles even though
   my German is still at a protozoic stage.  Whether you're a German
   wanting to learn Perl, or a Perl hacker wanting to learn German,
   I heartily recommend it.</p>

   <p>And talking of Germany, I'll embark tomorrow on a three-week vacation trip across
   the republic.  If there are any Perl mongers meeting this month around Duisburg,
   Morsbach or Schwieberdigen who wouldn't mind having an Ausländer in
   their midst, please feel free to drop me an email. :-)</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Académie des chasseurs de primes</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2009/02/academie-des-chasseurs-de-primes.html" />
    <id>tag:babyl.dyndns.org,2009:/techblog//1.161</id>

    <published>2009-02-14T23:41:52Z</published>
    <updated>2009-02-14T23:48:01Z</updated>

    <summary> Next week is going to see the release of the comic book album &apos;Académie des chasseurs de primes&apos; (art by Benoit Godbout, stories by Michel Lacombe and yours truly). If you are in Montréal, there&apos;s going to be a...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="acp" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="invitation_ACP.png" src="http://babyl.dyndns.org/techblog/acp/invitation_ACP.png" width="400" height="284" class="mt-image-right" style="float: right; margin: 0 0 20px 20px;" /></span> </p>

<p>Next week is going to see the release of 
the comic book album 'Académie des chasseurs 
de primes' (art by Benoit Godbout, stories
by Michel Lacombe and yours truly).  If you are in 
Montréal, there's going to be a reception Wednesday
that Ben and Michel will be attending (see attached image).</p>

<p>We have a <a href="http://academiedeschasseursdeprimes.ca/bande">movie teaser</a>,
and we'll soon have a working <a href="http://academiedeschasseursdeprimes.ca/">website</a> as well. <br />
The album itself will be sold in librairies in Québec and France.
I'll see if there's a way to have an internet sale channel as well.</p>
]]>
        

    </content>
</entry>

<entry>
    <title>CPAN Patching with Git</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2008/12/cpan-patching-with-git.html" />
    <id>tag:babyl.dyndns.org,2008:/techblog//1.160</id>

    <published>2008-12-29T19:18:26Z</published>
    <updated>2008-12-29T19:22:40Z</updated>

    <summary>=pod A few months ago, brian posted a blog entry about L. In the ensuing discussion, I pointed at a possible way to automatise the process a step further by punting the generated patch to rt.cpan.org. The hack was well-received...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
    <category term="gitperltpr" label="git perl tpr" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[=pod

A few months ago, brian posted a blog entry 
about 
L<patching modules using Git|http://use.perl.org/~brian_d_foy/journal/37664>.
In the ensuing discussion, I pointed at a possible way to
automatise the process a step further by punting the generated
patch to rt.cpan.org.  The hack was well-received  and, with
(very) minimal coaxing, I was subsequently convinced to 
expand on the idea for the Perl Review.

The resulting piece is now available in 
L<TPR 5.1|http://theperlreview.com>. In the article, the 
initial command-line hack has morphed into 
four scripts -- C<git-cpan-init>, C<git-cpan-clone>, 
C<git-cpan-update> and C<git-cpan-sendpatch> -- that
pretty much take care of all the administrative
overhead of module patching.  In most cases, 
grabbing a distro, fixing a bug and sending the
patch can be done in four lines:


    $ git cpan-init Some::Module  
    $ git checkout -b mypatch    
    ...hack hack hack...                                
    $ git rebase -i cpan        
    $ git cpan-sendpatch       

And, no, the lack of hyphen between C<git> and C<cpan-X>
isn't a typo; the article also covers how
to seamlessly integrate the new scripts into the 
git infrastructure (as Edna Mode would say, 
I<it's a non-feature, dahling>).

Of course, I'm burning to say more, but I'll have to stop here. 
To know the whole story, you'll have to wait for The Perl Review 
to land in your mailbox (you are subscribed to TPR, I<right?>).]]>
        
    </content>
</entry>

<entry>
    <title>introducing Dist::Release</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2008/11/introducing-distrelease.html" />
    <id>tag:babyl.dyndns.org,2008:/techblog//1.159</id>

    <published>2008-11-11T04:02:58Z</published>
    <updated>2008-11-11T04:40:11Z</updated>

    <summary>=pod I know, I know, there&apos;s already more module release managers out there than there are Elvis impersonators in Vegas. Still, module releasing seems to be a very personal kind of itch, and like so many before I couldn&apos;t resist...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="development" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[=pod

I know, I know, there's already more module release managers out there
than there are Elvis impersonators in Vegas.  Still, module releasing 
seems to 
be a very personal kind of itch, and like so many before 
I couldn't resist and 
came up with my very own scratching stick.

Of course, I've tried Module::Release.  But, although
it is intended to be customized to suit each author's specific needs, 
one has to dig fairly deep in the module's guts to do so.  What I 
really wanted was something even more plug'n'play, something that would
be brain-dead easy to plop new components in.  Hence Dist::Release.


In Dist::Release, the release process is seen as a sequence of steps. 
There are two different kind of steps: checks and actions.
Checks are non-intrusive verifications (i.e., they're
not supposed to touch anything), and actions are the steps
that do the active part of the release.  When one launches
a release, checks are done first.  If some fail, we abort the process. 
If they all pass, then we are good to go and the actions are done as well. 



=head2 Implementing a check

To create a check, all that is needed is one module with a 'check' method. 
For example, here is the code to verify that the distribution's MANIFEST
is up-to-date:


    package Dist::Release::Check::Manifest::Build;

    use Moose;

    use IPC::Cmd 'run';

    extends 'Dist::Release::Step';

    sub check {
        my $self = shift;

        $self->diag( q{running 'Build distcheck'} )

        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
        run( command => [qw# ./Build distcheck #] );

        return $self->error( join '', @$full_buf )
            if not $success or grep /not in sync/ => @$stderr_buf; 
    }

    1;


Dist::Release  considers the check to have failed if there is any call made
to C<error()>.  If there is no complain, then it assumes that everything is
peachy.

=head2 Implementing an action

Actions are only marginally more complicated than checks.  The module
implementing the action can have an optional C<check()> method, which is 
going to be run with all the other checks, and must have a C<release()>,
which make the release-related changes.

For example, here's the CPANUpload action:


    package Dist::Release::Action::CPANUpload;

    use Moose;

    use CPAN::Uploader;

    extends 'Dist::Release::Action';

    sub check {
        my ($self) = @_;

        # do we have a pause id?
        unless ($self->distrel->config->{pause}{id}
            and $self->distrel->config->{pause}{password} ) {
            $self->error('pause id or password missing from config file');
        }
    }

    sub release {
        my $self = shift;

        $self->diag('verifying that the tarball is present');

        my @archives = <*.tar.gz> or return $self->error('no tarball found');

        if ( @archives > 1 ) {
            return $self->error( 'more than one tarball file found: ' . join ',',
                @archives );
        }

        my $tarball = $archives[0];

        $self->diag("found tarball: $tarball");

        $self->diag("uploading tarball '$tarball' to CPAN");

        my ( $id, $password ) =
            map { $self->distrel->config->{pause}{$_} } qw/ id password /;

        $self->diag("using user '$id'");

        my $args = { user => $id, password => $password };

        unless ( $self->distrel->pretend ) {
            CPAN::Uploader->upload_file( $tarball, $args );
        }
    }

    1;

As for the C<check()>, Dist::Release figures out that a C<release()> failed 
if there's a call to C<error()>.  

=head2 Configuring for a module

Configuration is done via a 'distrelease.yml' file dropped in the root
directory of the project.  The file looks like this:

    pause:
        id: yanick
        password: hush 
    checks:
        - VCS::WorkingDirClean
        - Manifest
    actions:
        - GenerateDistribution
        - CPANUpload
        - Github

It's pretty self-explanatory.  The checks and actions are applied in the order
they are given in the file.

=head2 Crying havoc...

And once the configuration file is present, all that remains to be done is to run C<distrelease>, sit back and enjoy the show:

    $ distrelease
    Dist::Release will only pretend to perform the actions (use --doit for the real deal)
    running check cycle...
    regular checks
    VCS::WorkingDirClean              [failed]
    working directory is not clean
    # On branch master
    # Changed but not updated:
    #   (use "git add <file>..." to update what will be committed)
    #
    #       modified:   Build.PL
    #       modified:   Changes
    #       modified:   README
    #       modified:   distrelease.yml
    #       modified:   lib/Dist/Release/Check/Manifest.pm
    #       modified:   script/distrelease
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #       STDOUT
    #       a
    #       blog
    #       xml
    #       xt/dependencies.t
    #       xxx
    no changes added to commit (use "git add" and/or "git commit -a")
    Manifest                          [failed]
    No such file: lib/Dist/Release/Action/DoSomething.pm
    Not in MANIFEST: a
    Not in MANIFEST: blog
    Not in MANIFEST: lib/Dist/Release/Action/Github.pm
    Not in MANIFEST: STDOUT
    Not in MANIFEST: xml
    Not in MANIFEST: xt/dependencies.t
    Not in MANIFEST: xxx
    MANIFEST appears to be out of sync with the distribution
    pre-action checks
    GenerateDistribution              [passed]
    no check implemented
    CPANUpload                        [passed]
    Github                            [passed]
    2 checks failed
    some checks failed, aborting the release


=head2 Getting the good

A L<first release of Dist::Release|http://search.cpan.org/dist/Dist-Release/> 
is already waiting for you on CPAN.  It's beta, has no documentation, is
probably buggy as hell, but it's there.  And the code is also available on
L<Github|http://github.com/yanick/dist-release/tree/master>.  Comments,
suggestions, forks and patches are welcome, as always. :-)


]]>
        
    </content>
</entry>

<entry>
    <title>Me at OSBootCamp 8</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2008/09/me-at-osbootcamp-8-4.html" />
    <id>tag:babyl.dyndns.org,2008:/techblog//1.154</id>

    <published>2008-09-06T15:36:31Z</published>
    <updated>2009-05-10T22:18:01Z</updated>

    <summary>OS Bootcamp is a cool initiative to inform and initiate university students to the wonders of the Open Source world. OsBootCamp 8, which took place on August 28th, was about interpreted programming languages. On the agenda were short introductions of...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="conference" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="perl" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[<p><a href="http://www.osbootcamp.org">OS Bootcamp</a> is a cool initiative to inform and initiate 
university students to the wonders of the Open Source world.</p>

<p><a href="http://www.osbootcamp.org/index.php?page=yow8">OsBootCamp 8</a>,
which took place on August 28th,
was about interpreted programming languages.  On the agenda
were short 
introductions of the three
big kids on the block (Perl, Python and Ruby). <br />
And yup, the honor 
to ramble about Perl was given to li'll old me.  For
the morbidly curious, there's
a
<a href="http://www.virtualvernisage.com/archives/2008_aug29_633556336613281250/?hideSocial=false&amp;archiveID=85">video</a>
of the resulting show.  :-)</p>
]]>
        

    </content>
</entry>

<entry>
    <title>Pasting repository info on CPAN page</title>
    <link rel="alternate" type="text/html" href="http://babyl.dyndns.org/techblog/2008/08/pasting-repository-info-on-cpan-page-4.html" />
    <id>tag:babyl.dyndns.org,2008:/techblog//1.151</id>

    <published>2008-08-13T02:31:09Z</published>
    <updated>2008-09-30T22:49:17Z</updated>

    <summary>Out of the comments generated by a post by L, I&apos;ve learned that the location of the distribution&apos;s repository can be inserted in the L. Neato! And when grink asked if someone could come up with a Greasemonkey script to...</summary>
    <author>
        <name>Yanick</name>
        
    </author>
    
        <category term="greasemonkey" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://babyl.dyndns.org/techblog/">
        <![CDATA[Out of the comments  generated
by a post by L<grink|http://use.perl.org/~grink/journal/37141>,
I've learned that the location of the distribution's repository
can be inserted in the
L<META.yml|http://module-build.sourceforge.net/META-spec-current.html#resources>.
Neato!  

And when grink asked if someone could come up with a Greasemonkey
script to extract that information and show it on the distro's 
page... well, that's no simian fun I could let pass untackled. 
The 
resulting greasemonkey script can be found 
L<here|http://userscripts.org/scripts/show/31660>.]]>
        
    </content>
</entry>

</feed>
