Subject: | [PATCH] better check for packages limit |
Hello, Sean.
Our project uses up to 500 "modules/packages" and we're using your
module to report versions of the modules. We would like to suggest next
patch to count packages instead of records in the symbol tables.
--
Best regards, Ruslan.
Subject: | MVR_packages_limit.patch |
diff -ur Module-Versions-Report-1.02/lib/Module/Versions/Report.pm Module-Versions-Report-1.02-my/lib/Module/Versions/Report.pm
--- Module-Versions-Report-1.02/lib/Module/Versions/Report.pm 2003-06-22 11:26:43.000000000 +0400
+++ Module-Versions-Report-1.02-my/lib/Module/Versions/Report.pm 2006-10-10 17:26:47.000000000 +0400
@@ -2,6 +2,7 @@
require 5;
package Module::Versions::Report;
$VERSION = '1.02';
+$PACKAGES_LIMIT = 1000;
=head1 NAME
@@ -100,14 +101,15 @@
my $pref;
while(@stack) {
$this = shift @stack;
- die "Too many packages?" if ++$count > 1000;
+ die "Too many packages?" if $count > $PACKAGES_LIMIT;
next if exists $v{$this};
next if $this eq 'main'; # %main:: is %::
#print "Peeking at $this => ${$this . '::VERSION'}\n";
if(defined ${$this . '::VERSION'} ) {
- $v{$this} = ${$this . '::VERSION'}
+ $v{$this} = ${$this . '::VERSION'};
+ $count++;
} elsif(
defined *{$this . '::ISA'} or defined &{$this . '::import'}
or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
@@ -115,6 +117,7 @@
) {
# It's a class/module with no version.
$v{$this} = undef;
+ $count++;
} else {
# It's probably an unpopulated package.
## $v{$this} = '...';