The Musings of a Dyslexic Technologist

A blogging framework for bowtie.

mro - MRO::Compat catch

Your scanner is missing a heuristic exception… issue#6

  • issue #6
  • The Catch

Food for thought, if we update our Modules, don’t we want our users to use the current version, so should we not by default do the same with others Modules. Thus we always show the current version number, regardless.

issue #6.

When checking for the minimum perl version, each module in a distribution is checked in turn and the highest requirement returned. The blame ( explicit|syntax|external ) is available to check. The following typical code snippet causes confusion.

Code snippet showing a typical usage of MRO::Compact
1
2
3
4
5
6
7
8
9
BEGIN {
  # use Module::Runtime to work around the 5.8 require bugs
  if ($] < 5.009_005) {
    Module::Runtime::require_module('MRO::Compat');
  }
  else {
    require mro;
  }
}

Both of these available modules have the same problem.

Perl::MinimumVersion
Perl::MinimumVersion::Fast

Think that finding require mro syntax, means that the perl-minversion should be set to perl 5.010000

NB. perlmin . or perlmin-fast lib/module/name

Why this is stupid?

Because they both completely ignore the presence of MRO::Compat and it’s use.

The “mro” namespace provides several utilities for dealing with method resolution order and method caching in general in Perl 5.9.5 and higher.

This module provides those interfaces for earlier versions of Perl (back to 5.6.0 anyways).

It is a harmless no-op to use this module on 5.9.5+. That is to say, code which properly uses MRO::Compat will work unmodified on both older Perls and 5.9.5+.

If you’re writing a piece of software that would like to use the parts of 5.9.5+’s mro:: interfaces that are supported here, and you want compatibility with older Perls, this is the module for you.

Many thanks to ribasushi++ for showing me the light.

The Catch

Now for some heuristics :)

  • Scan dist for meta-2 phase-requirements
    • mro –> RuntimeRequires
    • MRO::Compat –> RuntimeRecommends
  • Check module for perl-minversion (pmv)
  • skip pmv if ( pmv blame = require mro; –> 5.010 && module contains MRO::Compat )
    • if output format meta-1.x recast MRO::Compat to requires (RuntimeRequires)

The following is the result of midgen -f mi showing meta-1.x format

The following is the result of midgen -f metajson showing meta-2.x format

nb: midgen v0.31_05 in GitHub

__END__