3 use Getopt::Long qw( GetOptions );
4 use Pod::Usage qw( pod2usage );
5 use Term::ANSIColor qw( color );
6 use FindBin; # we need to enforce which C4::Installer is used in case more than one is installed
10 use C4::Installer::PerlModules;
25 'm|missing' => \$missing,
26 'i|installed' => \$installed,
27 'u|upgrade' => \$upgrade,
30 'r|required' => \$req,
34 pod2usage(1) if $help || (!$missing && !$installed && !$upgrade && !$all);
36 my $koha_pm = C4::Installer::PerlModules->new;
37 $koha_pm->versions_info;
41 push @pm, 'missing_pm' if $missing || $all;
42 push @pm, 'upgrade_pm' if $upgrade || $all;
43 push @pm, 'current_pm' if $installed || $all;
46 print color 'bold blue' if $color;
48 Installed Required Module is
49 Module Name Version Version Required
50 --------------------------------------------------------------------------------------------
55 foreach my $type (@pm) {
57 $mod_type =~ s/_pm$//;
58 my $pm = $koha_pm->get_attr($type);
60 foreach my $pm (keys(%$_)) {
61 print color 'yellow' if $type eq 'upgrade_pm' && $color;
62 print color 'red' if $type eq 'missing_pm' && $color;
63 print color 'green' if $type eq 'current_pm' && $color;
64 my $required = ($_->{$pm}->{'required'}?'Yes':'No');
65 my $current_version = ($color ? $_->{$pm}->{'cur_ver'} :
66 $type eq 'missing_pm' || $type eq 'upgrade_pm' ? $_->{$pm}->{'cur_ver'}." *" : $_->{$pm}->{'cur_ver'});
68 if (($req && $required eq 'Yes') || !$req) {
70 @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<
71 $pm, $current_version, $_->{$pm}->{'min_ver'}, $required
78 if (($req && $required eq 'Yes') || !$req) {
88 print color 'bold blue' if $color;
90 --------------------------------------------------------------------------------------------
91 Total modules reported: $count ";
97 $footer .= "* Module is missing or requires an upgrade.\n\n";
101 print color 'reset' if $color;
114 At least one of -a, -m, -i, or -u flags must specified to not trigger help.
115 ./koha_perl_deps.pl -m [-b] [-r] [-c]
116 ./koha_perl_deps.pl -u [-b] [-r] [-c]
117 ./koha_perl_deps.pl -i [-b] [-r] [-c]
118 ./koha_perl_deps.pl -a [-b] [-r] [-c]
119 ./koha_perl_deps.pl [-[h?]]
125 =item B<-m|--missing>
127 lists all missing perl modules
129 =item B<-i|--installed>
131 lists all installed perl modules
133 =item B<-u|--upgrade>
135 lists all perl modules needing to be upgraded relative to Koha
139 lists all koha perl dependencies
140 This is equivalent to '-m -i -u'.
144 lists only the perl dependency name.
146 =item B<-r|--required>
148 filters list to only required perl dependencies.
152 formats the output in color; red = module is missing, yellow = module requires upgrading, green = module is installed and current
156 prints this help text
162 Chris Nighswonger <cnighswonger AT foundations DOT edu>
166 Copyright 2010 Foundations Bible College.
170 This file is part of Koha.
172 Koha is free software; you can redistribute it and/or modify it
173 under the terms of the GNU General Public License as published by
174 the Free Software Foundation; either version 3 of the License, or
175 (at your option) any later version.
177 Koha is distributed in the hope that it will be useful, but
178 WITHOUT ANY WARRANTY; without even the implied warranty of
179 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
180 GNU General Public License for more details.
182 You should have received a copy of the GNU General Public License
183 along with Koha; if not, see <http://www.gnu.org/licenses>.
185 =head1 DISCLAIMER OF WARRANTY
187 Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
188 A PARTICULAR PURPOSE. See the GNU General Public License for more details.