The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/env perl

use strict;
use IO::All;
use YAML::XS;

my $yaml = YAML::XS::LoadFile('Meta');
my $version =
    $yaml->{'=zild'}{version} ||
    $yaml->{version} ||
    die "Can't determine 'version' from 'Meta' file";

for my $module (io->dir('lib')->All_Files) {
    next unless "$module" =~ /\.pm$/;
    my $code = $module->all;
    my $new = $code;
    my $s = '[\ \t]';
    $new =~ s/^((?:our$s)?$s*\$[\w\:]*VERSION$s*=$s*)[^\na-z~]*;/$1'$version';/gm;
    if ($new ne $code) {
        print "Module '$module' changed version to '$version'.\n";
        $module->print($new);
    }
}