Subject: | version::vpp dies on Does::Not::Exist->VERSION, as opposed to version::vxs/normal perl |
Greetings,
I've found the following fatal issue with version.pm 0.69 in pure
perl form:
When requesting the Some::Module->VERSION method, if the module is
not able to be loaded, version::vpp throws a fatal error.
Normal perl, and version::vxs do not do this.
Here's an example:
# using normal perl:
$ perl -le'print Doest::Not::Exist->VERSION'
$
# using version::vxs
$ perl -I/tmp/vxs/darwin-2level/ -Mversion::vxs
-le'print Doest::Not::Exist->VERSION'
$
# using version::vpp
$ perl-Mversion::vpp -le'print Doest::Not::Exist->VERSION'
Doest::Not::Exist defines neither package nor VERSION--version check
failed at /opt/lib/perl5/site_perl/5.8.8/version/vpp.pm line 418.
$
This behaviour breaks ExtUtils::MakeMaker, including the one in the
latest stable perl (5.8.8) , which checks for the version of any prereq
as follows:
my $file = "$prereq.pm";
$file =~ s{::}{/}g;
eval { require $file };
my $pr_version = $prereq->VERSION || 0;
If version::vxs or no version at all are loaded, this works just fine,
but if version::vpp is loaded, this aborts the EU::MM code with a fatal
error, preventing a Makefile from being written.
For your reference, it uses this code (version::vpp:418):
*UNIVERSAL::VERSION = sub {
my ($obj, $req) = @_;
my $class = ref($obj) || $obj;
no strict 'refs';
eval "require $class" unless %{"$class\::"}; # already existing
die "$class defines neither package nor VERSION--version check failed"
if $@ or not %{"$class\::"};
Further down, more 'die' statements are encountered, which may not be
used in standard perl or version::vxs either.
I consider this is a critical bug in version::vpp to be used in CPANPLUS
or EU::MM/Module::Build. Can you see a way to fix while keeping to the
accepted semantics?
Thanks,
Jos