Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
syntax error at Script line 19, near "queue_name)" syntax error at Script line 39, near "}" Script had compilation errors. syntax error at /proj/in/db.cgi line 879, near "queue_name)"


What I have tried:

<pre>sub print_overall_summary  
{

  my $str = shift;
  $DBH = &connect or die "Cannot connect to the sql server \n";
  $DBH->do("USE $str;");
  my $stmt="select queue_name,jobs_pending,jobs_running from queues order by time desc ;";
  ;
  my $sth = $DBH->prepare( $stmt );
  $sth->execute() or print "Could not prepare_overall_summarydata";
  print "<script language=\"javascript\" type=\"text/javascript\"> \n"
; 
  print "\$(document).ready(function(){ \n";
  %TABLE_DATA =();   
  my @sys=qw/Adice Incisive Spectre Vcs Calibre Others/; 
  my $table = $sth->fetchall_hashref; 
  for my $r (@$table) { 
    my $name='Others'; 
    for my $s (@sys){ 
      if ($r->{queue_name)=~m/$s/i) {$name=$s; last;} 
      } 
    $TABLE_DATA{$name}{jobs_pending}+=$r->{jobs_pending};  
    $TABLE_DATA{$name}{jobs_running}+=$r->{jobs_running}; 
    } 
  for my $var(qw/running pending/) { 
    my @parts=(); 
    for my $s (@sys){ 
      push @parts,'["'.$s.'",'
                  .$TABLE_DATA{$s}{'jobs_'.$var}
                  .']'; 
      } 
    print 'var data_'.$var.'=['.join(',',@parts).']'."\n"; 
    } 
  print   " \n pieChart(\"placeholder39\",data_running,{title:\"<ce
nter>Jobs Running</center>\"});\n";
  print   " \n pieChart(\"placeholder41\",data_pending,{title:\"<ce
nter>Jobs Pending</center>\"});\n";
  print "});";
  print "</script>";
}
Posted
Updated 21-Mar-17 23:48pm
v2
Comments
Richard MacCutchan 22-Mar-17 5:28am    
The error messages are telling you what is wrong. You need to fix the syntax errors.
find data 22-Mar-17 5:46am    
In the above i had used the right syntax.I couldnt make it out the problem with which syntax?

1 solution

PERL
if ($r->{queue_name)=~m/$s/i) {$name=$s; last;}

Non-matching delimiters.
 
Share this answer
 
Comments
find data 22-Mar-17 5:37am    
still the errorswhich i have included are having.
Richard MacCutchan 22-Mar-17 6:13am    
Look at the errors, look at the code, does it match the documentation, is everything spelled correctly, are all delimiters correct ... ? This is called diagnosing the problem, a skill you need to learn.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900