/
usr
/
local
/
lp
/
apps
/
malre
/
scripts
/
File Upload :
llllll
Current File: //usr/local/lp/apps/malre/scripts/perl_mod_check.pl
#! /usr/bin/perl use strict; use warnings; sub fn_mod_check { ### Given a list of perl modules, check if they're located somewhere within @INC my @module_list = @_; my $b_exit = 1; if ( $module_list[-1] eq "0" ) { $b_exit = pop(@module_list); } ### Check for the modules. Compile a list of any that are not present. my @missing_modules; MODULES: for my $module ( @module_list ) { my $module2 = $module; $module2 =~ s/::/\//g; for my $dir ( @INC ) { if ( -f $dir . "/" . $module2 . ".pm" ) { next MODULES; } } push( @missing_modules, $module ); } ### If any of the modules are missing, let the user know and exit if ( @missing_modules && $b_exit ) { print "\e[31mYou will need to install the following Perl modules:\n\n"; for ( @missing_modules ) { print $_, "\n"; } print "\n"; print "In order to do so, run the following command:\n\n"; print "cpan -i @missing_modules\n\n\e[00m"; exit 1; } elsif ( @missing_modules ) { return 0; } return 1; } fn_mod_check(@ARGV); exit 0;
Copyright ©2k19 -
Hexid
|
Tex7ure