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

<channel>
	<title>dagolden &#187; dagolden</title>
	<atom:link href="http://www.dagolden.com/index.php/author/david/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dagolden.com</link>
	<description>Whatever comes to mind</description>
	<lastBuildDate>Mon, 23 Jan 2012 03:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Visualizing the Perl 5 support policy</title>
		<link>http://www.dagolden.com/index.php/1605/visualizing-the-perl-5-support-policy/</link>
		<comments>http://www.dagolden.com/index.php/1605/visualizing-the-perl-5-support-policy/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 03:43:33 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[p5p]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl programming]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1605</guid>
		<description><![CDATA[My last post showed historical Perl 5 release cycles, but comments I got on and off the blog suggested that my vaguely positive sentiments about the official support policy were misunderstood. This post expands and clarifies my view. I have redone my Perl 5 release cycle graph again with a few changes. First, for the [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.dagolden.com/index.php/1587/visualizing-perl-5-release-cycles/" target="_blank">last post</a> showed historical Perl 5 release cycles, but comments I got on and off the blog suggested that my vaguely positive sentiments about the <a href="http://perldoc.perl.org/perlpolicy.html" target="_blank">official support policy</a> were misunderstood.  This post expands and clarifies my view.</p>
<p>I have redone my Perl 5 release cycle graph again with a few changes.  First, for the v5.4 through v5.8 series, I have broken the line to the final release, which I consider to be "outliers".  <strong>I think the Perl community was lucky to get those releases</strong> — was lucky that someone stepped up and made them — and that they don't reflect a "normal development" or support cycle.</p>
<p>Second, I have <strong>projected an estimated lifecycle under the official support policy</strong> for v5.12, v5.14 and the not-yet-released v5.16. This represents an expectation for the normal support lifetime of these releases and I think shows a better contrast of expectations resulting from the support policy introduced with v5.14 compared to historical releases.</p>
<p><a href="http://www.dagolden.com/wp-content/uploads/2012/01/perl5-release-timeline-2.png"><img src="http://www.dagolden.com/wp-content/uploads/2012/01/perl5-release-timeline-2-300x214.png" alt="Perl 5 Release Timeline (Amended)" title="perl5-release-timeline-2" width="300" height="214" class="aligncenter size-medium wp-image-1606" /></a></p>
<p class="aligncenter"><em>click for larger view</em></p>
<p>My observations (ignoring outliers):</p>
<ul>
<li><strong>Prior to v5.14, there was a (sometimes lengthy) gap between the end of one stable series and the start of the next.</strong></li>
<li>The actively maintained periods of v5.4, v5.5 and v5.6 were shorter than the proposed support windows under the new policy</li>
<li>v5.8 had two different support paradigms.  Between v5.8.0 and v5.8.1 was a long gap similar to the v5.6 series.  v5.8.1 to v5.8.8 had a more regularly-spaced series of support releases.</li>
<li>v5.10 had the longest gap between initial release (v5.10.0) and the subsequent support release (v5.10.1)</li>
<li>v5.12 has had the most consistent pattern of support releases after the initial release, and is the only stable Perl 5 to have a (regular, not outlier) support release after the release of the next stable version</li>
<li>v5.14 was the first stable Perl 5 released under the new annual-release cycle</li>
</ul>
<p><strong>The new support policy most resembles a return to the best support period seen historically</strong> (v5.8.1 to v5.8.8), but without the subsequent gap to the next stable release.  </p>
<p>Why do I think this new policy is a positive step forward? Here are some reasons:</p>
<ul>
<li>The support policy is <strong>actually written down</strong>.  What expectations did anyone have prior?  I don't know.  But if I'm using Perl 5, I'd rather know what to expect that have to guess and hope for the best.</li>
<li><strong>The new policy offers a support window longer in practice than any Perl 5 except v5.8</strong> and more regular than any period except between v5.8.1 and v5.8.8</li>
<li>The new stable Perl 5 is available for migration testing mid-way through the support window of the prior stable release.  If there are issues with migration, users can be confident of support for their existing version for an additional year (and emergency security support for a year after that).</li>
<li>The annual release cycle means the change between one stable release and the next will be smaller, lowering migration risk</li>
</ul>
<p><strong>The new policy does cut off the "long tail" of expectations for an outlier release</strong>.  I can understand that for some companies or OS packagers, a two-year support window (three for security) might feel too short, even if that is longer than was typically seen historically.</p>
<p>Here is where the annual stable release cycle and monthly development release cycle offer a huge side benefit: there is now a well-documented, frequently-used, regularly-updated <a href="http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/release_managers_guide.pod" title="Release Manager's Guide" target="_blank">release manager's guide</a> for Perl 5.  Now, <strong>the release process is so easy that a moderately-skilled Perl software engineer without much prior exposure to the Perl source repository can make a Perl 5 release tarball in about a day</strong>.</p>
<p>This means that even if the core Perl 5 development team isn't supporting, say, v5.12 anymore, a motivated company or community group could do the work necessary to prepare their own "outlier" release and either petition the Perl 5 core team to release it or could release their own stable "micro-fork" for others with long-term support needs.  (There might even be a profitable business opportunity selling support for Perl versions past the official support window.)</p>
<p><strong>Previously, Perl 5 development used to be bursty, with long delays between stable releases and with unclear expectations for support.  Now, Perl 5 development happens like clockwork, and has a clear, written support policy.</strong></p>
<p><small><em>[Note: this post represents my individual opinion and was not reviewed by the Perl 5 Porters core development team; it may or may not represent the views of other core developers; it is certainly not an "official" statement of the Perl 5 Porters in any way]</em></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1605/visualizing-the-perl-5-support-policy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualizing Perl 5 release cycles</title>
		<link>http://www.dagolden.com/index.php/1587/visualizing-perl-5-release-cycles/</link>
		<comments>http://www.dagolden.com/index.php/1587/visualizing-perl-5-release-cycles/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 17:06:39 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[p5p]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[perl programming]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1587</guid>
		<description><![CDATA[Beginning with Perl 5, version 12, the Perl 5 language began an annual release cycle, with a new stable release around May of each year. Beginning with version 14, the Perl 5 maintainers also announced a formal support policy and ended support for version 10. This is a significant change from the history of Perl, [...]]]></description>
			<content:encoded><![CDATA[<p>Beginning with Perl 5, version 12, the Perl 5 language began an annual release cycle, with a new stable release around May of each year.  Beginning with version 14, the Perl 5 maintainers also announced a <a href="http://perldoc.perl.org/perlpolicy.html" title="perlpolicy" target="_blank">formal support policy</a> and ended support for version 10.</p>
<p>This is a significant change from the history of Perl, so I though it would be interesting to see how recent release cycles have compared to historic ones.  The chart below shows releases over time since Perl 5, version 4 when releases were more officially split between "stable" and intermediate releases.</p>
<p><a href="http://www.dagolden.com/wp-content/uploads/2012/01/perl5-release-timeline.png"><img src="http://www.dagolden.com/wp-content/uploads/2012/01/perl5-release-timeline-300x214.png" alt="" title="Perl 5 Release Timeline" width="300" height="214" class="aligncenter size-medium wp-image-1588" /></a></p>
<p class="aligncenter"><em>click for larger view</em></p>
<p>(Note: Starting with version 7, odd numbered versions were reserved for development releases and are omitted above.  Versions 13 and 15 moved to a monthly release cycle for easier community testing of incremental development.)</p>
<p>I think the overall change to a shorter development cycle will benefit both users and maintainers of Perl 5.  For users, each new release will be a smaller change from the previous, lowering upgrade risk, plus they can have confidence in an ongoing process of improvement.  For maintainers, it avoids taking away effort from mainline development to retro-fit patches into a Perl that is many years old and might have substantially different guts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1587/visualizing-perl-5-release-cycles/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Perl Oasis 2012 wrapup</title>
		<link>http://www.dagolden.com/index.php/1565/perl-oasis-2012-wrapup/</link>
		<comments>http://www.dagolden.com/index.php/1565/perl-oasis-2012-wrapup/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 03:45:32 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[opw]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1565</guid>
		<description><![CDATA[Last weekend I attended the Orlando Perl Workshop. While the "hallway track" is one of the best parts of Perl workshops, the talks I saw were also excellent. Here is an overview of the sessions I attended. Doing the Jitterbug Jonathan Leto (dukeleto) presented Jitterbug, a cross language continuous integration tool for git (and written [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend I attended the Orlando Perl Workshop.  While the "hallway track" is one of the best parts of Perl workshops,  the talks I saw were also excellent.  Here is an overview of the sessions I attended.</p>
<h2>Doing the Jitterbug</h2>
<p>Jonathan Leto (dukeleto) presented <a href="http://jitterbug.pl">Jitterbug</a>, a cross language continuous integration tool for git (and written in Perl).  It's a smaller, lighter tool than Jenkins, though it lacks distributed testing capabilities.  It seems really good for small to medium sized Perl projects, as it already understands how to build and test things with a Makefile.PL or Build.PL.  (<a href="https://github.com/leto/presentations/blob/master/2012/perl_oasis_doing_the_jitterbug/pres.pdf?raw=true">see slides</a> [pdf])</p>
<h2>Javascript is Code</h2>
<p>Jay Shirley (jshirley) gave a non-Perl talk that explained why Javascript tends in practice towards spaghetti code.  He recommended the YUI3 framework and explained why it provides better structure and why it would be familiar to Perl programmers used to Moose.</p>
<h2>A Brave New Perl World</h2>
<p>Stevan Little (stevan) presented some ideas from the work-in-progress prototype of a meta-object protocol (aka MOP) for the Perl 5 core.  I'm really excited by this and I think the design team is finding a pragmatic balance between power and simplicity.</p>
<h2>Tweakers Anonymous</h2>
<p>John Anderson (genehack) gave an editor-agnostic half-rant/half-tutorial about why and how to tweak your editor to be more productive and less repetitive.  There were some good tips that I've already put intro practice, like teaching the editor to automatically "chmod +x" when saving any "*.pl" file. (<a href="http://www.slideshare.net/genehackdotorg/tweakers-anonymous">see slides</a>)</p>
<h2>The First Thing Tak Did - Elegant Remote Control For Sysadmins</h2>
<p>Matt S. Trout (mst) showed an insanely complicated but powerful command line tool to remotely execute any pure Perl code over ssh, without needing any prerequisite modules installed on the remote machine.  It's worth exploring just to understand the magic that makes it work.</p>
<h2>Game Development with Perl &amp; SDL</h2>
<p>Breno Oliveira (garu) gave a playful talk that showed how easy it has become to use Perl to write simple graphical games.  In only a couple dozen lines of code, he demonstrated a simple 2D platform game using the built in physics model. (<a href="http://www.slideshare.net/garux/game-development-with-sdl-and-perl">see slides</a>)</p>
<h2>Cooking Perl with Chef Solo</h2>
<p>This was my talk, where I explained what I've been doing to make it possible to deploy Plack apps using Chef and Perlbrew and friends. (<a href="http://xdg.me/talks/cooking-perl-with-chef/">see slides</a>)</p>
<h2>Lightning talks</h2>
<p>There was the usually assortment of amusing talks, though several presenters thought it would be "fun" to present their 20 minute (or longer) talks in 5 minutes for anyone who missed the original.  (Note to future presenters -- please don't do that.  Pick 5 key slides and just show those.)</p>
<p>The most interesting to me was the lightning talk by Bruce Gray (util), who introduced <a href="http://rosettacode.org/wiki/Rosetta_Code">Rosetta Code</a>, a site that shows how different languages solve hundreds of common programming problems.  He said that Perl needs more solutions written to catch up to other languages, so if you have time and interest then please check it out.</p>
<h2>Keynote</h2>
<p>Cory Watson (gphat) gave a funny talk that in style was nearly worthy of Larry Wall.  It meandered around the broad theme of "diversity" and whether more ways of thinking about things makes one smarter.  It eventually circled back to Perl, but the overall call to action was to get out of the usual comfort zones and try something you haven't done before and aren't good at -- whether radical or minor -- in order to stretch your brain. (I can't do it justice in text -- I think you had to be there.)</p>
<h2>Hackathon</h2>
<p>On Sunday, I went for brunch with some other attendees and then parked myself at the hackathon until it was time to leave for the airport.  While I was there, I sucessfully ported my auto-install CD creation tools to work on Debian ISOs instead of just Ubuntu ISOs, so I can test my Perl/Chef tools on that server platform as well.</p>
<h2>Coda</h2>
<p>As a final note, Chris Prather (perigrin) -- who appeared ably supported by his family -- put on an excellent conference and I want to thank him for the work that went into it.  I hope I can attend again in 2013 and recommend it to anyone who wants to get away and have some fun with Perl in the dark of January.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1565/perl-oasis-2012-wrapup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yet another taint mode reminder</title>
		<link>http://www.dagolden.com/index.php/1560/yet-another-taint-mode-reminder-to-use-taint-mode-if-you-care-about-security/</link>
		<comments>http://www.dagolden.com/index.php/1560/yet-another-taint-mode-reminder-to-use-taint-mode-if-you-care-about-security/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 16:56:20 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1560</guid>
		<description><![CDATA[Schwern just posted "How (not) To Load a Module..." that goes into great depth about the security risk in loading modules. The (not) funny thing is that none of what he's saying is a risk would be one when running in taint mode. Consider "/tmp/foo.pm" with this: Then consider this example of how Module::Load does [...]]]></description>
			<content:encoded><![CDATA[<p>Schwern just posted <a href="http://blogs.perl.org/users/michael_g_schwern/2011/10/how-not-to-load-a-module-or-bad-interfaces-make-good-people-do-bad-things.html">"How (not) To Load a Module..."</a> that goes into great depth about the security risk in loading modules.</p>
<p>The (not) funny thing is that none of what he's saying is a risk would be one when running in taint mode.</p>
<p>Consider "/tmp/foo.pm" with this:</p>
<pre class="brush: perl; title: ; notranslate">
package foo;
print &quot;Loaded foo\n&quot;;
1;
</pre>
<p>Then consider this example of how Module::Load does something "unexpected":</p>
<pre class="brush: plain; title: ; notranslate">
$ perl -MModule::Load=load -wE 'my $file=shift; load $file' ::tmp::foo
Loaded foo
</pre>
<p>(The "threat" is that given an arbitrary module name to load, it will gladly load outside <code>@INC</code>.)</p>
<p>What if that was run under taint mode, instead?</p>
<pre class="brush: plain; title: ; notranslate">
$ perl -MModule::Load=load -wTE 'my $file=shift; load $file' ::tmp::foo
Insecure dependency in require while running with -T switch at /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/Module/Load.pm line 27.
Insecure dependency in require while running with -T switch at /home/david/perl5/perlbrew/perls/perl-5.14.0/lib/5.14.0/Module/Load.pm line 27.
</pre>
<p>I'm not sure why that message is printed twice, but that was still a fatal error and foo.pm didn't load.</p>
<p>The moral of the story: <strong>if you incorporate arbitrary user input into your execution path, use taint mode and validate the input to make sure it's something safe.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1560/yet-another-taint-mode-reminder-to-use-taint-mode-if-you-care-about-security/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to find files with Path::Class::Rule</title>
		<link>http://www.dagolden.com/index.php/1552/how-to-find-files-with-pathclassrule/</link>
		<comments>http://www.dagolden.com/index.php/1552/how-to-find-files-with-pathclassrule/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 01:38:37 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1552</guid>
		<description><![CDATA[Path::Class::Rule is what you get when you imagine the love-child of Path::Class and File::Find::Rule. Here is part of the SYNOPSIS: As you can see, it has the same method-chaining of rule helpers that File::Find::Rule does. However, it's not built on top of File::Find, so you get a real, lazy iterator instead of the File::Find::Rule iterator [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://p3rl.org/Path::Class::Rule" title="Path::Class::Rule" target="_blank">Path::Class::Rule</a> is what you get when you imagine the love-child of <a href="http://p3rl.org/Path::Class::Rule" title="Path::Class" target="_blank">Path::Class</a> and <a href="http://p3rl.org/File::Find::Rule" title="File::Find::Rule" target="_blank">File::Find::Rule</a>.  Here is part of the SYNOPSIS:</p>
<pre class="brush: perl; title: ; notranslate">
use Path::Class::Rule;

my $rule = Path::Class::Rule-&gt;new; # match anything
$rule-&gt;file-&gt;size(&quot;&gt;10k&quot;);         # add/chain rules

# iterator interface
my $next = $rule-&gt;iter( @dirs );
while ( my $file = $next-&gt;() ) {   # $file is a Path::Class object
  ...
}
</pre>
<p>As you can see, it has the same method-chaining of rule helpers that File::Find::Rule does.  However, it's not built on top of <a href="http://p3rl.org/File::Find" title="File::Find" target="_blank">File::Find</a>, so you get a real, lazy iterator instead of the File::Find::Rule iterator that precomputes the results and hands them to you one at a time. The iterator returns Path::Class objects, which makes it a little easier to do some common file manipulations.</p>
<p>While Path::Class::Rule is very new, it already implements the following kinds of rule helpers:</p>
<ul>
<li>File name rules</li>
<li>Directory skipping rules</li>
<li>File test rules, e.g. -f, -d, -r, -w, etc.</li>
<li>Stat test rules, e.g. results of stat()</li>
<li>Search depth rules</li>
<li>Perl file rules</li>
<li>Version control file skipping rules</li>
</ul>
<p>It's also easy to extend.  You only need to "and" together a callback that gets <code>$_</code> set to the Path::Class object under examination:</p>
<pre class="brush: perl; title: ; notranslate">
$rule-&gt;and( sub { -r -w -x $_ } ); # stacked filetest example
</pre>
<p>You can write extension classes with new helper methods using the <code>add_helper</code> method.  Here's a simple example that matches files named "foo":</p>
<pre class="brush: perl; title: ; notranslate">
package Path::Class::Rule::Foo;

use Path::Class::Rule;

Path::Class::Rule-&gt;add_helper(
  foo =&gt; sub {
    my @args = @_; # do this to customize closure with arguments
    return sub {
      my ($item) = shift;
      return if $item-&gt;is_dir;
      return $item-&gt;basename =~ /^foo$/;
    }
  }
);

1;
</pre>
<p>If this module sounds interesting, give it a try!  If you want to help improve it, <a href="https://github.com/dagolden/path-class-rule" title="Path::Class::Rule on github" target="_blank">fork it on Github</a> and let me know what you have in mind.</p>
<p>(If you're a curmudgeon and want to know why I wrote <em>another</em> file-finding module for CPAN, read the "SEE ALSO" section of the documentation for my comparison to other things out there.)</p>
<p><b>Update</b> I've released 0.004 with some additional SEE ALSO entries based on suggestions below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1552/how-to-find-files-with-pathclassrule/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Giving thanks as thanks</title>
		<link>http://www.dagolden.com/index.php/1543/giving-thanks-as-thanks/</link>
		<comments>http://www.dagolden.com/index.php/1543/giving-thanks-as-thanks/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 19:06:26 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1543</guid>
		<description><![CDATA[Ricardo wrote an article "promoting little gifts", which @perlbuzz tweeted as "giving little gifts as thanks". I like that idea, and it inspired me to remind people to please also consider just giving "thanks", too. Sure, I'd love a song or a small ebook (and maybe I should set up a wishlist), but I also [...]]]></description>
			<content:encoded><![CDATA[<p>Ricardo wrote an article <a href="http://rjbs.manxome.org/rubric/entry/1906">"promoting little gifts"</a>, which <a href="https://twitter.com/#!/perlbuzz">@perlbuzz</a> tweeted as <a href="https://twitter.com/#!/perlbuzz/status/106377273384505344">"giving little gifts as thanks"</a>.</p>
<p>I like that idea, and it inspired me to remind people to please also <strong>consider just giving "thanks", too</strong>.</p>
<p>Sure, I'd love a song or a small ebook (and maybe I should set up a wishlist), but <strong>I also love getting an email saying thanks</strong>, particularly when it is from someone I don't already know telling me that they like a module I released to CPAN or telling me how they are using my code to solve some problem they have.  <strong>Email is cheap, but still has huge impact</strong>.</p>
<p>Perl is a community built on altruism.  Don't forget to say thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1543/giving-thanks-as-thanks/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Code munging with vim: if modifier to if block</title>
		<link>http://www.dagolden.com/index.php/1539/code-munging-with-vim-if-modifier-to-if-block/</link>
		<comments>http://www.dagolden.com/index.php/1539/code-munging-with-vim-if-modifier-to-if-block/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 15:16:19 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1539</guid>
		<description><![CDATA[Not infrequently, I discover I want to turn an if modifier into an if block so I can add extra logic when the conditional is true. I decided to automate that with a vim macro: For it to work, the if modifier has to be on a line of its own (which I usually do [...]]]></description>
			<content:encoded><![CDATA[<p>Not infrequently, I discover I want to turn an if modifier into an if block so I can add extra logic when the conditional is true.</p>
<pre class="brush: perl; title: ; notranslate">
# from this
do_something()
  if condition();

# to this
if ( condition() ) {
  do_something();
}
</pre>
<p>I decided to automate that with a vim macro:</p>
<pre class="brush: plain; title: ; notranslate">
map ,if V:s/\(\s*\)  if \(.*\);/\1if (\2) {/&lt;CR&gt;kVdp&gt;&gt;$a;&lt;CR&gt;&lt;BS&gt;}&lt;CR&gt;&lt;Esc&gt;kkk^
</pre>
<p>For it to work, the if modifier has to be on a line of its own (which I usually do for code clarity) and the cursor needs to be on that line when running the macro.</p>
<p>Feel free to copy and adapt to your own needs and preferences.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1539/code-munging-with-vim-if-modifier-to-if-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Five ways to install module prereqs by hand</title>
		<link>http://www.dagolden.com/index.php/1528/five-ways-to-install-modules-prereqs-by-hand/</link>
		<comments>http://www.dagolden.com/index.php/1528/five-ways-to-install-modules-prereqs-by-hand/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 03:19:58 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[toolchain]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1528</guid>
		<description><![CDATA[Have you ever tried installing a CPAN module's dependencies by hand? Imagine that you've downloaded a strange tarball or cloned a strange module repository. Running "perl Makefile.PL" or "perl Build.PL" gives you a long list of missing dependencies. How do you quickly install all those dependencies? Here are some options. See the last for a [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever tried installing a CPAN module's dependencies by hand?  Imagine that you've downloaded a strange tarball or cloned a strange module repository. Running "perl Makefile.PL" or "perl Build.PL" gives you a long list of missing dependencies.  How do you quickly install all those dependencies?</p>
<p>Here are some options.  See the last for a new way that I just cooked up and released to CPAN.</p>
<h2>Use your favorite CPAN client against the current directory</h2>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
$ cpan .
</pre>
<p>Beware that this also installs the module in the current directory, which may not be what you want.</p>
<p>cpanminus is smarter than that if you give it an option</p>
<pre class="brush: plain; title: ; notranslate">
$ cpanm --installdeps .
</pre>
<h2>For Module::Build-based modules: Build installdeps</h2>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
$ perl Build.PL
$ Build installdeps
</pre>
<h2>For (some) Module::Install-based modules: make installdeps</h2>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
$ perl Makefile.PL
$ make installdeps
</pre>
<p>Note that this requires the Makefile.PL to use the 'auto_install' plugin.</p>
<h2>For Dist::Zilla-based modules: dzil listdeps</h2>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
$ dzil listdeps | cpanm
# or
$ cpan $(dzil listdeps)
</pre>
<p>This requires installing Dist::Zilla any any dist.ini dependencies first:</p>
<pre class="brush: plain; title: ; notranslate">
$ cpanm Dist::Zilla
$ dzil authordeps | cpanm
</pre>
<p>(Notice a pattern here?)</p>
<h2>Anything with Makefile.PL or Build.PL: MYMETA and mymeta-requires</h2>
<p>Install the latest ExtUtils::MakeMaker, Module::Build and <a href="http://p3rl.org/App::mymeta_requires">App::mymeta_requires</a>.  Then configure as usual and run 'mymeta-requires' to get a list of dependencies.</p>
<p>Example:</p>
<pre class="brush: plain; title: ; notranslate">
$ perl Makefile.PL
$ mymeta-requires | cpanm
# or
$ cpan $(mymeta-requires)
</pre>
<p>A nice feature of 'mymeta-requires' is that it gives you access to all the different prerequisite types defined in the <a href="http://p3rl.org/CPAN::Meta::Spec">CPAN::Meta::Spec</a>.  So if a module offers 'develop' prerequisites, you can include those like this:</p>
<pre class="brush: plain; title: ; notranslate">
$ mymeta-requires --develop | cpanm
</pre>
<p>See the documentation for other ways to control which prerequisites are included in the output.</p>
<p><del datetime="2011-08-14T11:41:59+00:00">One drawback is that you'll still need to install any configuration prerequisites needed to run Makefile.PL or Build.PL, but that is true of all other recipes above (except that ones that use a CPAN client).</del></p>
<p><strong>Update:</strong> as of version 0.002, 'mymeta-requires' will fallback to a META.json|yml file and also picks up configuration prerequisites.  So now you can bootstrap completely like this:</p>
<pre class="brush: plain; title: ; notranslate">
# get configuration prerequisites
$ mymeta-requires | cpanm

# run configuration
$ perl Makefile.PL

# get any additional dynamic prerequisites from configuration
$ mymeta-requires | cpanm
</pre>
<p>Easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1528/five-ways-to-install-modules-prereqs-by-hand/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>What are your top binary library dependencies?</title>
		<link>http://www.dagolden.com/index.php/1523/what-are-your-top-binary-library-dependencies/</link>
		<comments>http://www.dagolden.com/index.php/1523/what-are-your-top-binary-library-dependencies/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 00:59:53 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1523</guid>
		<description><![CDATA[On the #toolchain IRC channel, jawnsy and I were discussing how cool it would be if there were Alien::* packages for the top 10 or so binary libraries that people use with Perl. I.e. things like libssl, libxml2, libexpat, etc. I don't know what it would take to make that happen, because getting Alien packages [...]]]></description>
			<content:encoded><![CDATA[<p>On the <a href="irc://irc.perl.org/#toolchain" title="#toolchain" target="_blank">#toolchain</a> IRC channel, <a href="http://jawnsy.wordpress.com" title="jawnsy" target="_blank">jawnsy</a> and I were discussing how cool it would be if there were <a href="http://p3rl.org/Alien" target="_blank">Alien::*</a> packages for the top 10 or so binary libraries that people use with Perl.  I.e. things like libssl, libxml2, libexpat, etc.</p>
<p>I don't know what it would take to make that happen, because getting Alien packages right across platforms is tricky, but a first step is figuring out what libraries people wind up needing the most.</p>
<p><strong>If you install libraries/headers by hand, what do you wind up using most often?</strong>  Please answer in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1523/what-are-your-top-binary-library-dependencies/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Sorting photos by timestamp with Perl</title>
		<link>http://www.dagolden.com/index.php/1508/sorting-photos-by-timestamp-with-perl/</link>
		<comments>http://www.dagolden.com/index.php/1508/sorting-photos-by-timestamp-with-perl/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 01:04:10 +0000</pubDate>
		<dc:creator>dagolden</dc:creator>
				<category><![CDATA[perl programming]]></category>
		<category><![CDATA[ironman]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dagolden.com/?p=1508</guid>
		<description><![CDATA[My digital picture frame does a slideshow in filename order. I have hundreds of pictures taken over several years on different cameras with different file naming schemes. I've even rolled over the counter on one of the cameras, so I might have IMG1234.jpg twice (saved in different directories). Here's how I used Perl to rename [...]]]></description>
			<content:encoded><![CDATA[<p>My digital picture frame does a slideshow in filename order.  <strong>I have hundreds of pictures taken over several years on different cameras with different file naming schemes.</strong> I've even rolled over the counter on one of the cameras, so I might have IMG1234.jpg twice (saved in different directories).</p>
<p><strong>Here's how I used Perl to rename these pictures</strong> into the right order based on the timestamp metadata inside the JPEG files:</p>
<pre class="brush: perl; title: ; notranslate">
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use autodie;
use Digest::MD5 'md5_hex';
use Image::ExifTool 'ImageInfo';
use Path::Class;

for my $f ( dir()-&gt;children ) {
  next if $f-&gt;is_dir;
  my $exif = Image::ExifTool-&gt;new;
  $exif-&gt;ExtractInfo($f-&gt;stringify);
  my $date = $exif-&gt;GetValue('DateTimeOriginal', 'PrintConv');
  next unless defined $date;
  $date =~ tr[ :][T-];
  my $digest = md5_hex($f-&gt;slurp);
  $digest = substr($digest,0,7);
  my $new_name = &quot;$date-$digest.jpg&quot;;
  unless ( $f-&gt;basename eq $new_name ) {
    rename $f =&gt; $new_name;
    say &quot;renamed $f =&gt; $new_name&quot;;
  }
}
</pre>
<p>This program renames everything in the current directory into a format like this "2011-05-28T14-48-20-7fc2e71.jpg" -- which is an ISO8601 datetime (with "-" instead of ":") plus the first 7-hex-characters of an MD5 checksum.  I use the checksum on the off-chance that two pictures were taken at the exact same second (e.g. from two cameras) or that one picture was a cropped/retouched version of an original.  Anything that doesn't have EXIF datetime information is skipped and then I have to examine those manually to sort them into the rest.</p>
<p>It's not much, but it's quick and it worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagolden.com/index.php/1508/sorting-photos-by-timestamp-with-perl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

