use File::Find ;
use strict ;
my %modules = () ;
my %versions = () ;
find(\&rech_pm, @INC);
foreach my $nom (sort keys %modules) {
printf "%-50s %s\n", $modules{$nom}, $versions{$nom} ;
}
sub rech_pm {
if ($File::Find::name =~ /\.pm$/) {
open(F, $File::Find::name) || return;
my $nom_fic = $File::Find::name ;
my $version = '' ;
while(<F> ) {
if ( /VERSION *= *['"]([0-9.]+)['"]/ ) {
$version = $1 ;
}
if (/^ *package +(\S+);/) {
my $nom_m = $1 ;
my $nom = "$nom_fic:$nom_m" ;
$modules{lc($nom)} = $nom_m ;
$versions{lc($nom)} = $version ;
}
}
close(F);
}
}
|