parent
66d132cd4b
commit
11a8110922
1 changed files with 8 additions and 18 deletions
|
@ -645,19 +645,6 @@ sub mysql_setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub try_load {
|
|
||||||
my $mod = shift;
|
|
||||||
|
|
||||||
eval("use $mod");
|
|
||||||
|
|
||||||
if ($@) {
|
|
||||||
#print "\$@ = $@\n";
|
|
||||||
return(0);
|
|
||||||
} else {
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# MySQL Request Array
|
# MySQL Request Array
|
||||||
sub select_array {
|
sub select_array {
|
||||||
my $req = shift;
|
my $req = shift;
|
||||||
|
@ -2804,17 +2791,20 @@ sub dump_result {
|
||||||
debugprint "HTML REPORT: $opt{'reportfile'}";
|
debugprint "HTML REPORT: $opt{'reportfile'}";
|
||||||
|
|
||||||
if ($opt{'reportfile'} ne 0 ) {
|
if ($opt{'reportfile'} ne 0 ) {
|
||||||
if (try_load('Text::Template')) {
|
eval "{ use Text::Template }";
|
||||||
|
if ($@) {
|
||||||
badprint "Text::Template Module is needed.";
|
badprint "Text::Template Module is needed.";
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
use Text::Template;
|
|
||||||
|
|
||||||
my $vars= {'data' => Dumper( \%result ) };
|
my $vars= {'data' => Dumper( \%result ) };
|
||||||
|
|
||||||
my $template = Text::Template->new(TYPE => 'STRING', PREPEND => q{;}, SOURCE => $templateModel)
|
my $template;
|
||||||
or die "Couldn't construct template: $Text::Template::ERROR";
|
{
|
||||||
|
no warnings 'once';
|
||||||
|
$template = Text::Template->new(TYPE => 'STRING', PREPEND => q{;}, SOURCE => $templateModel)
|
||||||
|
or die "Couldn't construct template: $Text::Template::ERROR";
|
||||||
|
}
|
||||||
open my $fh, q(>), $opt{'reportfile'}
|
open my $fh, q(>), $opt{'reportfile'}
|
||||||
or die "Unable to open $opt{'reportfile'} in write mode. please check permissions for this file or directory";
|
or die "Unable to open $opt{'reportfile'} in write mode. please check permissions for this file or directory";
|
||||||
$template->fill_in(HASH =>$vars, OUTPUT=>$fh );
|
$template->fill_in(HASH =>$vars, OUTPUT=>$fh );
|
||||||
|
|
Loading…
Reference in a new issue