+ like ($@, qr/lib version 100.105 required--this is only version 35.036000/);
+}
+
+
+{
+ # Regression test for patch 14937:
+ # Check that a .pm file with no package or VERSION doesn't core.
+ open F, ">xxx.pm" or die "Cannot open xxx.pm: $!\n";
+ print F "1;\n";
+ close F;
+ eval "use lib '.'; use xxx 3;";
+ like ($@, qr/^xxx defines neither package nor VERSION--version check failed at/);
+ unlink 'xxx.pm';
+}
+
+my @ver = split /\./, sprintf "%vd", $^V;
+
+foreach my $index (-3..+3) {
+ foreach my $v (0, 1) {
+ my @parts = @ver;
+ if ($index) {
+ if ($index < 0) {
+ # Jiggle one of the parts down
+ --$parts[-$index - 1];
+ } else {
+ # Jiggle one of the parts up
+ ++$parts[$index - 1];
+ }
+ }
+ my $v_version = sprintf "v%d.%d.%d", @parts;
+ my $version;
+ if ($v) {
+ $version = $v_version;
+ } else {
+ $version = $parts[0] + $parts[1] / 1000 + $parts[2] / 1000000;
+ }
+
+ eval "use $version";
+ if ($index > 0) {
+ # The future
+ like ($@,
+ qr/Perl $v_version required--this is only \Q$^V\E, stopped/,
+ "use $version");
+ } else {
+ # The present or past
+ is ($@, '', "use $version");
+ }
+
+ eval "no $version";
+ if ($index <= 0) {
+ # The present or past
+ like ($@,
+ qr/Perls since $v_version too modern--this is \Q$^V\E, stopped/,
+ "no $version");
+ } else {
+ # future
+ is ($@, '', "no $version");
+ }