---- rpm-4.0/scripts/perl.req Wed Jul 5 14:26:37 2000
-+++ rpm-4.0.new/scripts/perl.req Wed Nov 15 21:31:03 2000
-@@ -82,6 +82,53 @@
+--- rpm-4.2/scripts/perl.req.wigperl Tue Apr 1 13:33:52 2003
++++ rpm-4.2/scripts/perl.req Tue Apr 1 13:39:47 2003
+@@ -39,28 +39,20 @@
+
+ # by Ken Estes Mail.com kestes@staff.mail.com
+
+-if ("@ARGV") {
+- foreach (@ARGV) {
++foreach ( @ARGV ? @ARGV : <> ) {
++ chomp;
+ if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
+ if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
+- process_file($_);
++ process_file($_) if -f;
+ }
+ }
+- }
+-} else {
+-
+- # notice we are passed a list of filenames NOT as common in unix the
+- # contents of the file.
+-
+- foreach (<>) {
+- if (m=/usr/(sbin|bin|lib|share|X11R6/(lib|bin))/=) {
+- if (! m=(/(doc|man|info|usr/src)/|\.(so|ph|h|html|pod)$)=) {
+- process_file($_);
+- }
+- }
+- }
+ }
+
++foreach (sort keys %provide) {
++ delete $require{$_};
++}
++delete $require{the}; # don't count "use the sth" as perl module
++
+
+ foreach $module (sort keys %require) {
+ if (length($require{$module}) == 0) {
+@@ -82,6 +74,53 @@
exit 0;
sub process_file {
-@@ -90,6 +137,8 @@
+@@ -90,6 +129,8 @@
- open(FILE, "<$file")||
- die("$0: Could not open file: '$file' : $!\n");
-+
-+ return if (!is_perlfile($file, \*FILE));
+ open(FILE, "<$file") || return;
++ return if (!is_perlfile($file, \*FILE));
++
while (<FILE>) {
-@@ -209,6 +258,10 @@
- # if the module name starts in a dot it is not a module name.
+ # skip the documentation
+@@ -111,6 +152,10 @@
+ last;
+ }
- ($module =~ m/^\./) && next;
++ if (m/^\s*package\s+([_:a-zA-Z0-9]+)\s*;/) {
++ $provide{$1} = 1;
++ }
+
+ # Each keyword can appear multiple times. Don't
+ # bother with datastructures to store these strings,
+ # if we need to print it print it now.
+@@ -236,6 +281,10 @@
+
+ ($module =~ m/^\./) && next;
+
+ # name starts in a non alphanumeric character it is not a module
+ # name.
+ ($module =~ m/^\W/) && next;
-
++
# if the module ends with .pm strip it to leave only basename.
+ $module =~ s/\.pm$//;