Andreas J. Koenig wrote:
> Hi John,
> 
> last November we had a painful thread about the fact that
> Module::Build is completely unavailable for older bleadperls:
> 
> http://www.nntp.perl.org/group/perl.module.build/2006/11/msg443.html
> 
> I've since been hit more than once by this serious drawback. People
> ask me to do some binary searches for module X and whenever X uses
> Module::Build and the area of failure is before patch 25000 or so (do
> not know the exact number) I usually have to give up because MB cannot
> work with perl's version.pm and cannot use its own version.pm for the
> reasons you explained in the cited thread.
> 
> I could imagine a perl-only version of version.pm would be able to
> resolve this given that I could enforce it to run on these bleadperls.
> Is this something you could imagine doing? What's the scope that would
> need to be dealt with? Any other ideas how this could be fixed or
> worked around?

MB recommends version 0.661 and does not require it.  The problem is it
doesn't check for broken versions.  Module::Build::Version has a _verify()
routine to check for valid version objects.  It also has code to check if
version.pm loaded successfully and if not to fall back to a stub.

        eval "use version $VERSION";
        if ($@) { # can't locate version files, use our own

Maybe the solution is as simple as:

        eval "use version $VERSION";
        if ( $@ or !_verify( version->new($Some_Version) ) ) {

where $Some_Version is whatever version number version.pm is choking on.  Then
it can spot that bad version of version and just not use it.

Also, what's _verify() doing sniffing around in the guts of version.pm objects
anyway?

sub _verify {
    my ($self) = @_;
    if ( ref($self)
        && eval { exists $self->{version} }
        && ref($self->{version}) eq 'ARRAY'
        ) {
        return 1;
    }
    else {
        return 0;
    }
}

That seems wrong and will break in the future.  If you want to verify you have
a working object, try out its functionality.  Don't poke inside.

While I'm looking at it, META.yml recommends version 0.661 but it would seem
that Module::Build::Version won't accept anything less than 0.7203.

  use vars qw($VERSION);
  $VERSION = 0.7203;

  eval "use version $VERSION";
  if ($@) { # can't locate version files, use our own

I'd guess the recommended version has to be bumped up?

Reply via email to