<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Modern Perl Books, a Modern Perl Blog</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/" />
    <link rel="self" type="application/atom+xml" href="http://www.modernperlbooks.com/mt/atom.xml" />
    <id>tag:www.modernperlbooks.com,2009-01-23:/mt//1</id>
    <updated>2010-03-10T22:55:00Z</updated>
    <subtitle>Modern Perl programming, circa 2010, relies on the collected wisdom of the entire Perl ecosystem.  It&apos;s time to write elegant, reliable, maintainable, well-tested, and predictable code.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.23-en</generator>

<entry>
    <title>What CPAN Doesn&apos;t Do</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/2010/03/what-cpan-doesnt-do.html" />
    <id>tag:www.modernperlbooks.com,2010:/mt//1.159</id>

    <published>2010-03-10T22:29:20Z</published>
    <updated>2010-03-10T22:55:00Z</updated>

    <summary>Configuration-Free CPAN Installations and What&apos;s Wrong with Module::Install both hinted at a fundamental difficulty in managing software from the CPAN. Enough teasing. The fundamental assumption of the CPAN that makes managing software through CPAN clients difficult is that newer software...</summary>
    <author>
        <name>chromatic</name>
        <uri>http://www.wgz.org/~chromatic</uri>
    </author>
    
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modernperl" label="modern perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl5" label="perl 5" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="systemadministration" label="system administration" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.modernperlbooks.com/mt/">
        <![CDATA[<p><a href="http://www.modernperlbooks.com/mt/2010/03/configuration-free-cpan-installations.html">Configuration-Free CPAN Installations</a> and <a href="http://www.modernperlbooks.com/mt/2010/03/whats-wrong-with-moduleinstall.html">What's Wrong with Module::Install</a> both hinted at a fundamental difficulty in managing software from the CPAN.  Enough teasing.</p>

<p>The fundamental assumption of the CPAN that makes managing software through CPAN clients difficult is that <em>newer software can always replace older software</em>.</p>

<p>That's not the CPAN's problem, not really.  <a
href="http://www.modernperlbooks.com/mt/2009/12/the-guess-the-version-game.html">Perl
5 has this version number problem too</a>, and it's the source of much of the
backwards compatibility troubles in the Perl 5 world.</p>

<p>On the CPAN, no one agrees on what version numbers mean.  No one agrees on
backwards compatibility concerns.  No one agrees about what makes one release
"stable" and another release "testing" or what you can change in an API.</p>

<p>I'm not sure it's the job of CPAN or the CPAN maintainers to try to solve this problem.  The lack of rules and ceremony over the <em>function</em> of uploaded code and the loose agreement on the <em>form</em> of uploaded code have allowed CPAN to thrive where other languages with their own packaging and distribution systems have fragmented into incompatible, warring fiefdoms.</p>

<p>Even still, fighting over whether <code>Module::Build</code> is of the devil
because (insert silly reason here) or complaining that
<code>Module::Install</code> is a stupid patch over a pile of nasty, almost
unsupported hacks misses the real point.  The best possible improvement in the
Perl 5/CPAN ecosystem is to know which versions of which distributions work
together, and for end users to be able to download a known-working graph of
their desired distribution and its dependencies.</p>

<p>In other words, the big problem isn't that <code>Module::Install</code> has
a nicer interface (arguable) or <code>ExtUtils::MakeMaker</code> is a horrific
pile of barely-working hacks that shouldn't have survived into the 21st century
(indisputable).  The problem is the integration of separate components managed
by separate maintainers with wildly disparate ideas of the semantics of change
over indeterminate periods of time.</p>

<p>At any single given point in time, any given CPAN distribution should work correctly with its currently available upstream dependencies.  With the current system, we cannot guarantee that perturbation in those dependency graphs will percolate to users at any point in the future.</p>

<p>In my mind, <a href="http://use.perl.org/~Alias/journal/40225">arguing over
whether an improvement to the CPAN ecosystem can take over for every use case
of the current tools</a> is stupid and wrong (or, more charitably, a silly
distraction).  Improving the user and developer experiences of the current
tools and the current system is good, but the real improvements in the system
will not occur at the interface level.</p>

<p>(Of course, the problem with Adam's point of view is that requiring any
credible replacement to handle every possible failure case before stamping it
with an imprimatur is that "better" is not an all or nothing concern.  I have
no illusion that it's possible to fix the Perl 5 versioning scheme for every
case.  If we can fix it for 90% of cases, surely that's a reasonable
improvement.)</p>
]]>
        
    </content>
</entry>

<entry>
    <title>Configuration-Free CPAN Installations</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/2010/03/configuration-free-cpan-installations.html" />
    <id>tag:www.modernperlbooks.com,2010:/mt//1.158</id>

    <published>2010-03-06T20:11:00Z</published>
    <updated>2010-03-08T22:05:50Z</updated>

    <summary><![CDATA[Module::Install exists because installing CPAN distributions is not always perfectly easy. Unfortunately, it didn't help&mdash;at least, not entirely. According to the completely unscientific process by which I install CPAN distributions, Module::Install accounts for a greater amount of pain than it...]]></summary>
    <author>
        <name>chromatic</name>
        <uri>http://www.wgz.org/~chromatic</uri>
    </author>
    
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modernperl" label="modern perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl5" label="Perl 5" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.modernperlbooks.com/mt/">
        <![CDATA[<p><a
href="http://www.modernperlbooks.com/mt/2010/03/whats-wrong-with-moduleinstall.html">Module::Install
exists because installing CPAN distributions is not always perfectly
easy</a>.</p>

<p>Unfortunately, it didn't help&mdash;at least, not entirely.  According to
the completely unscientific process by which I install CPAN distributions,
<code>Module::Install</code> accounts for a greater amount of pain than it
should, at least according to its frequency of use.  (Again, this is completely
<em>unscientific</em>.  I could guess that half of the CPAN client sessions
which encounter Module::Install require me to fix things manually, but it's
probably closer to 20%.  It's more memorable because of my severe dislike for
M::I <em>prompting</em> to install dependencies during configuration time.)</p>

<p>M::I addresses a real bootstrapping problem.  I want to be able to use
libraries during configuration, building, testing, and installation.  I don't
know which versions of those libraries you have available.  Bundling known-good
versions of those libraries with the distribution itself solves part of that
problem...</p>

<p>... except when it doesn't.  If I were to use M::I, I would have to
re-release all of my distributions for every new release of every bundled
library, at least if they contain important bug fixes for the various platforms
about which I care.  The cheap perfume of static linking leaves its musk heavy
in the air.</p>

<p>It's easy to fall into the trap of a false dilemma.  "You fool!" you prepare
to comment below.  "It's either that or the chaos of trying to make do with
whatever version of those dependencies users may or may not have installed on
their systems!"  You're right; those are two possibilities.  They're not the
only two possibilities.</p>

<p>Part of the real problem is that bootstrapping during configuration is much
too late.  By the time you're running the configuration system, you're already
running the configuration system.  If your version of the configuration system
is too old or too new, you have a problem.  Bail out?  Revert?  Upgrade?
There's no good heuristic for determining this.  (The CPAN itself has an
opinion.  That's part of the problem.)</p>

<p>M::I hackers do deserve credit for helping to develop the <em>META.yml</em>
standard.  (I think M::I is the wrong approach, but I intend no slight toward
its users, advocates, and developers.  Invention requires the courage to get
things wrong sometimes, even as it requires the courage to abandon false
leads.) The <a
href="http://module-build.sourceforge.net/META-spec-current.html">META.yml</a>
specification is a big step in the right direction.  If <em>most</em> CPAN
modules have static requirements and follow a standard set of conventions,
there's little or no configuration necessary.  A sufficiently smart CPAN client
can perform the appropriate configuration without running code from the
distribution itself.</p>

<p>You can't avoid that in all cases; distributions with XS components, for
example, need to probe system information.  Good luck writing a sufficiently
smart CPAN client and getting the community to agree on specific standards that
let you find OpenGL headers in a cross-platform fashion, for example.  Yet if
80% of CPAN distributions can get by with static, upload-time configuration, a
lot of complexity of installation can go away.</p>

<p>Yes, that would make <code>Module::Build</code> and
<code>ExtUtils::MakeMaker</code> unnecessary for (probably) most CPAN
distributions, at least at the point of configuration, building, and
installation.  (I'm a recent fan of <a
href="http://search.cpan.org/perldoc?Dist::Zilla">Dist::Zilla</a> for
automating away tedium on behalf of distribution maintainers; there's less need
for <code>Module::Install</code> in such a world.  If I never write another
<em>Build.PL</em> again, so much the better.)</p>

<p>That helps, but the real problem with CPAN installations is that the CPAN
itself is merely an uploading, indexing, and mirroring system.  Projects such
as <em>META.yml</em> attempt to add (and extract) meaning from the system, but
they cannot work around one fundamental design feature of the CPAN.
<em>That</em> limitation is the source of most woes for end users.</p>

<p>Clever readers (or experienced CPAN users) have already identified this
limitation.  I'll reveal it in the next installment.</p>
]]>
        
    </content>
</entry>

<entry>
    <title>The 99% Rule</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/2010/03/the-99-rule.html" />
    <id>tag:www.modernperlbooks.com,2010:/mt//1.157</id>

    <published>2010-03-03T00:41:02Z</published>
    <updated>2010-03-03T00:45:37Z</updated>

    <summary>David Golden praised Tatsuhiko Miyagawa&apos;s excellent new cpanminus CPAN client in The power of not being all things to all people. You should consider using cpanminus. Don&apos;t overlook something else insightful that David wrote: It&apos;s a lot of work to...</summary>
    <author>
        <name>chromatic</name>
        <uri>http://www.wgz.org/~chromatic</uri>
    </author>
    
    <category term="cpan" label="CPAN" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="languagedesign" label="language design" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modernperl" label="modern perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl5" label="perl 5" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl6" label="Perl 6" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="timtowtdi" label="TIMTOWTDI" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.modernperlbooks.com/mt/">
        <![CDATA[<p>David Golden praised Tatsuhiko Miyagawa's excellent new <a href="http://search.cpan.org/perldoc?App::cpanminus">cpanminus</a> CPAN client in <a href="http://www.dagolden.com/index.php/689/the-power-of-not-being-all-things-to-all-people/">The power of not being all things to all people</a>.  You should consider using cpanminus.</p>

<p>Don't overlook something else insightful that David wrote:</p>

<blockquote>It's a lot of work to be all things to all people and I keep wondering whether making things simpler and better for 99% of people would be a better choice.</blockquote>

<p>The only reliable way I've ever seen to "make the easy things easy and the hard things possible" is to make the easy things the default without preventing customization of the hard things.  That's a design principle for languages, APIs, and tools.</p>

<p>Figure out what's most common (though not necessarily what people think they want, but what they need).  Optimize for that.  Consider what they might need and don't prevent it.</p>

<p>That's not easy, and what people need will change over time, but if you want to solve problems well, you have to solve the right problems.</p>]]>
        
    </content>
</entry>

<entry>
    <title>What&apos;s Wrong with Module::Install</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/2010/03/whats-wrong-with-moduleinstall.html" />
    <id>tag:www.modernperlbooks.com,2010:/mt//1.156</id>

    <published>2010-03-01T23:33:39Z</published>
    <updated>2010-03-02T01:07:17Z</updated>

    <summary>I&apos;ve never liked ExtUtils::MakeMaker. I&apos;ve liked Module::Build from the beginning. I&apos;ve never, ever liked Module::Install, even though Ingy sat in my living room and hacked on what would eventually become M::I way back several years ago. I don&apos;t believe people...</summary>
    <author>
        <name>chromatic</name>
        <uri>http://www.wgz.org/~chromatic</uri>
    </author>
    
    <category term="cpan" label="cpan" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="modernperl" label="modern perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl5" label="perl 5" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perlprogramming" label="perl programming" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.modernperlbooks.com/mt/">
        <![CDATA[<p>I've never liked <a href="http://search.cpan.org/perldoc?ExtUtils::MakeMaker">ExtUtils::MakeMaker</a>.  I've liked <a href="http://search.cpan.org/perldoc?Module::Build">Module::Build</a> from the beginning.  I've never, ever liked <a href="http://search.cpan.org/perldoc?Module::Install">Module::Install</a>, even though <a href="http://ingy.net/">Ingy</a> sat in my living room and hacked on what would eventually become M::I way back several years ago.</p>

<p>I don't believe <a href="http://chris.prather.org/shot-on-sight.md.html">people who use Module::Install should be shot on sight</a>, but I do believe that Module::Install has set the usability of the CPAN back by several years.</p>

<p>Ingy <em>did</em> identify a real problem: there's too much code strewn about the configuration and build systems of the CPAN and not enough code shared.  When he found himself writing something complicated to configure, compile, and install a new distribution, he'd crib code from someone like Tim Bunce or Graham Barr or Nick Ing-Simmons.  In other words, to make the CPAN&mdash;perhaps the world's largest repository of redistributable and sharable library code&mdash;work, he had to copy and paste code.</p>

<p>M::I did get that right; turning the configuration and build system into reusable, redistributable libraries also available from the CPAN helped reduce the amount of boilerplate code and the amount of copy and paste code in configuration systems.  The people behind M::I have also helped push for better configuration of CPAN clients and better tracking of dependencies and versions and types of dependencies (optional, compilation, bundling, testing, et cetera).  The CPAN ecosystem is better off for that work, even though M::I itself isn't the answer.</p>

<p>One of M::I's biggest failings, of course, is that it prolongs the lifespan of EU::MM.  Unfortunately, I think Ingy missed the big problem when he saw copy and paste code.  To do anything reasonably complex with EU::MM, you have to be able to write Perl 5 code which generates (and modifies with regular expressions) cross-platform Makefiles which themselves call into Perl 5 code because Perl 5 has a sane baseline of well-understood and reliable behavior across platforms in a way that Makefiles and shells do not.</p>

<p>If that's not sufficient horror, consider that the way to customize EU::MM behavior the last time I looked at it (Two notes here.  First, its current maintainer <em>refuses</em> to add new features or change existing features because it's so awful to maintain.  Second, I wrote tests for some of those behaviors, so I've read and understood the code.) you write a custom <em>superclass</em> called <code>MY</code> from which EU::MM <em>inherits</em> to change the behavior of the various steps of generating cross-platform Makefiles which may or may not invoke Perl 5 to perform shell functions.</p>

<p>I am not making this up and I did not make any typos.  EU:MM <em>inherits from</em> your custom class.</p>

<p>Keeping EU::MM viable long past the point where Module::Build did everything n a saner way is but a little crime.  (There's a reason almost no one recommends the use of <code>h2xs</code> to make skeletons for new modules anymore; most new modules aren't mere wrappers around C libraries.  The need for a compilation step with a pure-Perl distribution seems more than a little bit superfluous.)</p>

<p>Module::Install reinvoking your current CPAN client recursively to install dependencies when your current CPAN client already has a perfectly good way to install dependencies is a slightly larger crime.  (I understand the justification; what if someone is trying to install a distribution from a tarball manually without a CPAN client, but is there a Principle of Least Possible Differentiation at work with that design choice?)</p>

<p>I don't particularly care that using M::I as a distribution maintainer means that you have to keep track of every new release of M::I which could fix bugs or make upgrading impossible and release a new version of every one of your distributions with the new M::I because of its autobundling problems, because if you get your kicks that way, more power to you.  (Don't expect me to jump up and down for joy at upgrading all of your distributions on my machines, though.)</p>

<p>I never particularly cared for the FUD about Module::Build from some M::I discussions, especially the nonsense about "Module::Build doesn't support <code>--install</code> so it spews files all over the place!" (as if EU::MM ever worked properly there) or "Module::Build doesn't support uninstalling!" (as if anyone ever used that from the CPAN client to know that it worked with <em>any</em> system.)</p>

<p>I appreciate that Module::Install provided a much nicer interface than EU::MM did, and that that interface worked transparently to hide the nasty details of EU::MM.  Those are true benefits, and I don't blame anyone for choosing M::I for that reason.</p>

<p>Even so, Module::Install's greatest crime is that it's been a distraction from identifying and fixing the real problems of the CPAN... but that's another post.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Perl 5, Support, and Bugfixes</title>
    <link rel="alternate" type="text/html" href="http://www.modernperlbooks.com/mt/2010/02/perl-5-support-and-bugfixes.html" />
    <id>tag:www.modernperlbooks.com,2010:/mt//1.155</id>

    <published>2010-02-26T21:34:55Z</published>
    <updated>2010-02-26T21:57:17Z</updated>

    <summary>I wrote what I understand to be the strategy behind releasing new minor releases of Perl 5. Though the development branch of Perl 5 follows a monthly release cycle, the maintenance branch currently does not. If it&apos;s difficult to predict...</summary>
    <author>
        <name>chromatic</name>
        <uri>http://www.wgz.org/~chromatic</uri>
    </author>
    
    <category term="modernperl" label="modern perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl" label="perl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="perl5" label="perl 5" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="softwaredevelopment" label="software development" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="support" label="support" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.modernperlbooks.com/mt/">
        <![CDATA[<p>I wrote what I understand to be <a href="http://www.modernperlbooks.com/mt/2010/02/the-unwritten-rules-of-perl-5-minor-releases.html">the strategy behind releasing new minor releases of Perl 5</a>.  Though the development branch of Perl 5 follows a monthly release cycle, the maintenance branch currently does not.  If it's difficult to predict what changes volunteer developers will make in the future, it's doubly difficult to predict which bugs they will fix (or will need to fix).</p>

<p>Thus any support document must explain the responsibilities of <em>users</em> who encounter bugs and what they should expect from developers.</p>

<p>A bug you discover in a new major release of Perl 5 is a candidate for a new minor release if it is:</p>

<ul>

<li>A security or dataloss bug</li>
<li>A regression introduced in the new major release</li>
<li>A failure to build on a supported platform combination</li>
<li>A failing core test on a supported platform</li>

</ul>

<p>I've organized that list in rough order of decreasing severity.  The most likely candidate for a fix is the second; it indicates an undertested aspect of the system.  Behavior should not change between Perl 5 releases accidentally.  If a patch modified behavior on which your code depends and if that change did not occur as part of a deliberate, communicated plan, a fix is likely.</p>

<p>Of course, any fix in a minor release needs to maintain binary compatibility within the release family.</p>

<p>The easiest way (at least for developers) to find and fix such bugs is before the release of a new major version of Perl 5.  That's one goal of the monthly releases: to encourage you to test all of the code you care about with versions of Perl 5 in development.  That's also one reason for the Perl 5 release candidates (though it's likely too late for big fixes by then).</p>

<p>If you can't do that, the next step to reporting a bug is to reproduce it in
the smallest example possible.  10-15 lines of Perl 5 is good.  2-3 is ideal.
More than 20 is usually too big.  If you can provide a test case suitable for
adding to the core test suite, so much the better.  From there, test your code
with multiple releases of Perl 5.  It helps to browse the <a
href="http://perldoc.perl.org/perldelta.html">perldelta</a> documentation, but
the amount of detail between even minor releases can be daunting.  A post on <a
href="http://www.perlmonks.org/">PerlMonks</a> is a good step.</p>

<p>If you've gone through all of that, see <a href="http://perldoc.perl.org/perlbug.html">perldoc perlbug</a>.</p>

<p>This is all no guarantee that your bug will get fixed in a minor version&mdash;you should prepare for the possibility that, given enough time since the release of the corresponding major version, the best approach for p5p is <em>not</em> to backport a fix to a new minor version.  Even so, you will likely get one of several options:</p>

<ul>
<li>An explanation of why it's not a bug</li>
<li>A suggested workaround</li>
<li>A fix in the current version</li>
</ul>

<p>In the latter case, you will have the option of applying the relevant patch yourself or asking someone to backport it to your own custom Perl 5 if you wish.  That may not seem like the ideal situation (it isn't!), but at least with free software such as Perl, you always have that option.</p>]]>
        
    </content>
</entry>

</feed>
