/usr/lib/R/site-library/gdata/perl/module_tools.pl is in r-cran-gdata 2.13.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | #!/usr/bin/perl
BEGIN {
use File::Basename;
# Add current path to perl library search path
use lib dirname($0);
}
use strict;
use warnings;
use Data::Dumper;
use Cwd;
sub check_modules(;$)
{
my(
$VERBOSE,
$HAS_Spreadsheet_ParseExcel,
$HAS_Compress_Raw_Zlib,
$HAS_Spreadsheet_XLSX
);
$VERBOSE=$_[0];
# Check if we can load the libraries we need
eval
{
require Spreadsheet::ParseExcel;
$HAS_Spreadsheet_ParseExcel=1;
print "Loaded Spreadsheet::ParseExcel\n" if $VERBOSE;
};
eval
{
require Compress::Raw::Zlib;
$HAS_Compress_Raw_Zlib=1;
print "Loaded Compress::Raw::Zlib\n" if $VERBOSE;
};
eval
{
require Spreadsheet::XLSX;
$HAS_Spreadsheet_XLSX=1;
print "Loaded Spreadsheet::XLSX\n" if $VERBOSE;
};
if($VERBOSE)
{
print "ERROR: Unable to load Spreadsheet::ParseExcel perl module! \n"
if !$HAS_Spreadsheet_ParseExcel;
print "ERROR: Unable to load Compress::Raw::Zlib perl module! \n"
if ! $HAS_Compress_Raw_Zlib;
print "ERROR: Unable to load Spreadsheet::XLSX perl module! \n"
if ! $HAS_Spreadsheet_XLSX;
}
return $HAS_Spreadsheet_ParseExcel, $HAS_Compress_Raw_Zlib, $HAS_Spreadsheet_XLSX;
}
sub check_modules_and_notify()
{
my(
$HAS_Spreadsheet_ParseExcel,
$HAS_Compress_Raw_Zlib,
$HAS_Spreadsheet_XLSX) = check_modules(0);
$HAS_Spreadsheet_ParseExcel or
die("ERROR: Perl module Spreadsheet::ParseExcel cannot be loaded. Exiting.\n");
$HAS_Compress_Raw_Zlib or
warn("WARNING: Perl module Compress::Raw::Zlib cannot be loaded.\n");
$HAS_Spreadsheet_XLSX or
warn("WARNING: Perl module Spreadsheet::XLSX cannot be loaded.\n");
($HAS_Compress_Raw_Zlib && $HAS_Spreadsheet_XLSX ) or
warn("WARNING: Microsoft Excel 2007 'XLSX' formatted files will not be processed.\n");
return $HAS_Spreadsheet_ParseExcel, $HAS_Compress_Raw_Zlib, $HAS_Spreadsheet_XLSX;
}
sub install_modules()
{
my($mod, $obj, $here);
$here = dirname($0);
# load the module
require CPAN;
# initialize CPAN components
CPAN::HandleConfig->load();
CPAN::Shell::setup_output();
CPAN::Index->reload();
# set the target install path
CPAN::Shell->o("conf", "makepl_arg",
"PREFIX=$here LIB=$here --prefix $here --install-base $here");
CPAN::Shell->install("Compress::Raw::Zlib");
#return 0;
# install the libraries we want
for $mod (qw( Compress::Raw::Zlib Spreadsheet::XLSX )){
my $obj = CPAN::Shell->expand('Module',$mod);
$obj->install;
}
}
1;
|