On Fri, 12 Jan 2007 14:16:27 -0800, Frank Merrow <[EMAIL PROTECTED]>
wrote:
>So we have a fairly complicated test system based largely on Perl.
>
>A reoccurring issue we face is the user "copying" modules that we've
>installed into their own directories and then putting that directory
>BEFORE our system's directory in PERL5LIB. There are occasionally
>legitimate reasons for this, but it creates a time bomb that might
>not go off for a long time.
>
>It can work for months this way until the upgrade one of the
>components . . . the *.PM file we install gets updated where we think
>it lives, but the user's copy is in front of ours in PERL5LIB . . .
>things break and it takes us hours (sometimes) to track these issues down.
>
>I was thinking of writing a utility to take apart PERL5LIB, Look for
>*.PM files in each of those directories and then output a report if a
>given *.PM file appears in two places in the PERL5LIB paths. For us
>on a clean system there typically are any duplicates.
>
>However, this sounds like something SOMEBODY ELSE must has already needed.
>
>Anyone out there already have such a tool I can just use instead of develop?
I've attached a script we used to use for a similar purposes. It relies
on ActiveState::ModInfo from ActivePerl 817 or later.
Cheers,
-Jan
#!perl -w
# This script will traverse all the modules found via @INC and will
# fail if any modules is present in more than one location.
print "1..1\n";
use strict;
use lib "lib";
use ActiveState::ModInfo qw(list_modules);
my %dup_allowed;
if ($^O eq "MSWin32") {
my $v = $ActivePerl::VERSION || Win32::BuildNumber() || 0;
if ($v >= 800 && $v < 900) {
$dup_allowed{"Win32"}++;
}
}
my %seen;
my $shadow;
my @modules = list_modules(allowdup => 1);
while (@modules) {
my($mod, $file) = splice(@modules, 0, 2);
if ($seen{$mod}) {
$shadow++ unless $dup_allowed{$mod};
warn "# $mod found at:
# $seen{$mod}
# $file
";
}
else {
$seen{$mod} = $file;
}
}
print "# " . keys(%seen) . " modules found\n";
print "not " if $shadow;
print "ok 1\n";
_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs