I'm new to perl CGI and trying to print hash data to html using perl CGI. Below is my code.
#!/usr/bin/perl
use strict;
use warnings;
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
our %dashboard_data;
my $q = new CGI;
################################################################################
## Read the dashboard_data file
require "partition_tsv_dashboard.pl";
print $q->header,
$q->start_html('Top Level TSV Dashboards'),
$q->h1('Top Level TSV Dashboards'),
foreach my $model (sort keys %{$dashboard_data{'project'}}){
$q->h2("Model: $model"),
}
$q->end_html;
The partition_tsv_dashboard.pl is the nested hash. Contains below data.
#!/usr/bin/perl
$dashboard_data {'project'} {'model1'} {'P00'} {'TSV-193'} {'COMP_0_P00'} = '';
$dashboard_data {'project'} {'model2'} {'P00'} {'TSV-001'} {'COMP_0_P00'} = '';
$dashboard_data {'project'} {'model3'} {'P00'} {'TSV-001'} {'COMP_0_P00'} = '';
$dashboard_data {'project'} {'model4'} {'P00'} {'TSV-001'} {'COMP_0_P00'} = '';
$dashboard_data {'project'} {'model5'} {'P00'} {'TSV-001'} {'COMP_0_P00'} = '';
1;
I'm getting below error when I try execute the CGI program. How do I map the a hash values to CGI object? Can someone help me with this.
Output.
Software error:
syntax error at /web/keystone/cgi-bin/tsv_dashboard.pl line 26, near "$model ("
Execution of /web/keystone/cgi-bin/tsv_dashboard.pl aborted due to compilation errors.