Subject: | Module::Versions attempts to report version numbers for files that are not modules |
When 'do $file' is invoked, an entry is made in %INC for the file that was executed. When Module::Versions attempts to report a version number for this file, it emits a warning like this:
Warning: Use of "require" without parentheses is ambiguous at (eval 3) line 1.
(See the attached script for an example.)
It's probably best to skip files that are not modules, perhaps reporting version numbers only for files ending in ".pm" or something.
Subject: | do-version.pl |
#!/usr/local/bin/perl
use strict;
use warnings;
use Module::Versions;
unless (-e './tmp') {
mkdir('./tmp') or die "Could not mkdir(./tmp) - $!";
}
my $file = "tmp/do-version-temp-$$";
open(my $fh, '>', $file) or die "Could not create '$file' - $!";
print $fh <<"EOF";
{
a => 1,
b => 2,
};
EOF
close($fh) or die "Could not write '$file' - $!";
my $h = do $file;
# Warning: Use of "require" without parentheses is ambiguous at (eval 3) line 1.
Module::Versions->HASH;
unlink($file) or die "Could not unlink '$file' - $!";
rmdir('./tmp') or die "Could not rmdir(./tmp) - $!";