From 77b3c916a2350fda8cdb4a78e720200f1ccd9cc8 Mon Sep 17 00:00:00 2001 From: dataking Date: Tue, 25 Oct 2016 16:50:40 -0700 Subject: [PATCH] Attempts at making modules required only for use. --- lynis_report.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lynis_report.pl b/lynis_report.pl index 10320db..c71a45d 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -8,10 +8,7 @@ no if $] ge '5.018', warnings => "experimental::smartmatch"; use Term::ANSIColor; use Getopt::Long qw( :config no_ignore_case bundling ); use Data::Dumper; -#use Spreadsheet::WriteExcel; -use Excel::Writer::XLSX; -#use File::Basename; -use HTML::HTMLDoc; +use Module::Load::Conditional qw( can_load check_install requires ); my ($help,$verbose,$excel,$output,$pdf); GetOptions( @@ -149,6 +146,7 @@ delete($lynis_report_data{'tests_executed'}); #print Dumper(\%warnings); if ($excel) { + require Excel::Writer::XLSX; my $i = 0; # do the Excel thing.... my $wb = Excel::Writer::XLSX->new($output); @@ -1981,6 +1979,7 @@ END } if ($pdf) { + require HTML::HTMLDoc; my $htmlobj = new HTML::HTMLDoc(); $htmlobj->set_input_file($htmldoc); my $pdfdoc = $htmlobj->generate_pdf();