VERSION_FROM in ExtUtils::MakeMaker scans a file for the
first line matching:
/([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
Then evals it, using the result as the version.
This snippet does it from the command line to check that everything works as you expect.
perl -nle 'if(/([\$*])(([\w\:'\'']*)\bVERSION)\b.*\=/){ eval $_; print
+ "$ARGV:\n$@$_\n\$$2 = $$2\n";close ARGV; undef $VERSION}' a b c d
Sample output:
a:
(our $VERSION = '3.0')
$VERSION = 3.0
b:
my $VERSION = 2.0;
$VERSION =
c:
Undefined subroutine &main::qv called at (eval 3) line 1, <> line 2.
our $VERSION = qv(1.0);
$VERSION =
d:
use version; our $VERSION = qv(1.0);
$VERSION = v1.0.0