sub getVersion { my $file = shift; my $c = ""; open(MOD, $file) or die $!; my $inpod = 0; my $result; # Thieved from Module::Info which itself thieved from # ExtUtils::MM_Unix 1.12603 while () { $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; next if $inpod || /^\s*#/; chomp; next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/; my $eval = qq{ package vTree::_version; no strict; local $1$2; \$$2=undef; do { $_ }; \$$2 }; $c = $1 if/(#.*$)/; local $^W = 0; $result = eval($eval); warn "Could not eval '$eval' in $parsefile: $@" if $@; $result = "undef" unless defined $result; last; } close MOD; return ([$result,$c]); }