Koha/installer/externalmodules.pl
Aleisha Amohia 20a38ee50e Bug 20000: Use Modern::Perl in installer scripts
To test:

Check that we are using Modern::Perl when strict *and* warnings were used before,
and commented lines and FIXMEs have been removed from the rest, out of
files listed below.

data/mysql/backfill_statistics.pl
data/mysql/labels_upgrade.pl
data/mysql/patroncards_upgrade.pl
data/mysql/update22to30.pl
data/mysql/updatedatabase.pl
externalmodules.pl
html-template-to-template-toolkit.pl
install.pl

Sponsored-by: Catalyst IT
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-02-04 16:57:14 +00:00

27 lines
1 KiB
Perl
Executable file

#!/usr/bin/perl
# This Script can be used to provide a list of ALL external modules ***used*** (uncommented) in Koha.
# It provides you not only the list of modules BUT ALSO the files that uses those modules.
# utf8 or warnings or other lib use are not taken into account at the moment.
use Modern::Perl;
use C4::Context;
my $dir=C4::Context->config('intranetdir');
qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >/tmp/modulesKoha.log);
$dir=C4::Context->config('opacdir');
qx(grep -r "^ *use" $dir | grep -v "C4\|strict\|vars" >>/tmp/modulesKoha.log);
open FILE, "< /tmp/modulesKoha.log" ||die "unable to open file /tmp/modulesKoha.log";
my %modulehash;
while (my $line=<FILE>){
if ( $line=~m#(.*)\:\s*use\s+([A-Z][^\s;]+)# ){
my ($file,$module)=($1,$2);
my @filename = split /\//, $file;
push @{$modulehash{$module}},$filename[scalar(@filename) - 1];
}
}
print "external modules used in Koha ARE :\n";
map {print "* $_ \t in files ",join (",",@{$modulehash{$_}}),"\n" } sort keys %modulehash;
close FILE;
unlink "/tmp/modulesKoha.log";