Attempts at making modules required only for use.

This commit is contained in:
dataking 2016-10-25 16:50:40 -07:00
parent 02fa08c6ad
commit 77b3c916a2

View File

@ -8,10 +8,7 @@ no if $] ge '5.018', warnings => "experimental::smartmatch";
use Term::ANSIColor; use Term::ANSIColor;
use Getopt::Long qw( :config no_ignore_case bundling ); use Getopt::Long qw( :config no_ignore_case bundling );
use Data::Dumper; use Data::Dumper;
#use Spreadsheet::WriteExcel; use Module::Load::Conditional qw( can_load check_install requires );
use Excel::Writer::XLSX;
#use File::Basename;
use HTML::HTMLDoc;
my ($help,$verbose,$excel,$output,$pdf); my ($help,$verbose,$excel,$output,$pdf);
GetOptions( GetOptions(
@ -149,6 +146,7 @@ delete($lynis_report_data{'tests_executed'});
#print Dumper(\%warnings); #print Dumper(\%warnings);
if ($excel) { if ($excel) {
require Excel::Writer::XLSX;
my $i = 0; my $i = 0;
# do the Excel thing.... # do the Excel thing....
my $wb = Excel::Writer::XLSX->new($output); my $wb = Excel::Writer::XLSX->new($output);
@ -1981,6 +1979,7 @@ END
} }
if ($pdf) { if ($pdf) {
require HTML::HTMLDoc;
my $htmlobj = new HTML::HTMLDoc(); my $htmlobj = new HTML::HTMLDoc();
$htmlobj->set_input_file($htmldoc); $htmlobj->set_input_file($htmldoc);
my $pdfdoc = $htmlobj->generate_pdf(); my $pdfdoc = $htmlobj->generate_pdf();