Change 13033 by jhi@alpha on 2001/11/16 00:37:36

        Add Larry Shatzer's VERSION verifying script.

Affected files ...

.... //depot/perl/MANIFEST#621 edit
.... //depot/perl/Porting/checkVERSION.pl#1 add
.... //depot/perl/Porting/pumpkin.pod#33 edit

Differences ...

==== //depot/perl/MANIFEST#621 (text) ====
==== //depot/perl/Porting/pumpkin.pod#33 (text) ====
Index: perl/Porting/pumpkin.pod
--- perl/Porting/pumpkin.pod.~1~        Thu Nov 15 17:45:05 2001
+++ perl/Porting/pumpkin.pod    Thu Nov 15 17:45:05 2001
@@ -241,6 +241,9 @@
 File::Copy to become aware of your native filesystem syntax and
 peculiarities.
 
+Remember to have a $VERSION in the modules.  You can use the
+Porting/checkVERSION.pl script for checking this.
+
 =item documentation
 
 If your operating system comes from outside UNIX you almost certainly

==== //depot/perl/Porting/checkVERSION.pl#1 (text) ====
Index: perl/Porting/checkVERSION.pl
--- perl/Porting/checkVERSION.pl.~1~    Thu Nov 15 17:45:05 2001
+++ perl/Porting/checkVERSION.pl        Thu Nov 15 17:45:05 2001
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+#
+# Check the tree against missing VERSIONs.
+#
+# Originally by Larry Shatzer
+#
+
+use strict;
+use File::Find;
+
+find(
+     sub {
+        return unless -f;
+        if (/\.pm$/ && $File::Find::name !~ m:/t/:) { # pm but not in a test
+            unless (parse_file($_)) {
+                print "$File::Find::name\n";
+            }
+        }
+     }, @ARGV ? shift : ".");
+
+sub parse_file {
+    my $parsefile = shift;
+
+    my $result;
+
+    open(FH,$parsefile) or warn "Could not open '$parsefile': $!";
+
+    my $inpod = 0;
+    while (<FH>) {
+       $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod;
+       next if $inpod || /^\s*\#/;
+       chomp;
+       next unless /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/;
+       my $eval = qq{
+           package ExtUtils::MakeMaker::_version;
+           no strict;
+           local $1$2;
+           \$$2=undef; do {
+               $_
+           }; \$$2
+       };
+       no warnings;
+       $result = eval($eval);
+       warn "Could not eval '$eval' in $parsefile: $@" if $@;
+       $result = "undef" unless defined $result;
+       last;
+    }
+    close FH;
+    return $result;
+}
+
End of Patch.

Reply via email to