In a Perl distribution, what would be the recommended way to specify a "dependency" type that says: update these modules to at least these versions, if you have them installed?
I would do something like (untested):
In the Makefile.PL, list all dependencies along with their minimum required versions:
...
my %min_version = (Some/Place/Foo.pm => 0.06, # need at least version
+0.06 of Some::Place::Foo
Other/Spot/Bar.pm => 1.35, # need at least version
+1.35 of Other::Spot::Bar
Baz.pm => 2.72, # need at least version
+2.72 of Baz
);
my @prereqs;
for(keys(%min_version)) {
eval {require $_};
# Ignore modules that don't load.
unless($@){
my $m = $_;
$m =~ s/\//::/g;
$m =~ s/\.pm$//;
my $v = $min_version{$_};
push @prereqs($m, $v);
}
}
my %h = @prereqs;
....
And then, in WriteMakefile() section of the Makefile.PL, I would specify:
...
'PREREQ_PM' => \%h,
...
Cheers,
Rob