Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.

by gvs_jagan (Initiate)
on Aug 15, 2005 at 12:38 UTC ( #483823=perlquestion: print w/ replies, xml ) Need Help??
gvs_jagan has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, i have made the corrections as suggested in the previous threads. However, iam still encountering the following error

Missing right curly or square bracket at jsdisp.cgi line 178, at end of line syntax error at jsdisp.cgi line 178, at EOF
. Execution of jsdisp.cgi aborted due to compilation errors.

I have numbered the left curly brackets in the code with (#1...#12) and the right curly brackets with (#1'...#12').
I request once again for the wisdom of the monks.

thanking in advance , jagan

. code as follows

-------------------------------------------------------------

#!/usr/bin/perl use DBI ; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowsers fatalsToBrowser); my($username) = "someuser"; my($password) = "knownuser"; my($dbh) = DBI->connect ("DBI:mysql:hf", $username , $passwor +d); my($empName) = param("empName"); my($year) = param("year"); my($mon) = param("mon"); my($count) = 0; my($sth , @arr); DBI -> trace(4 , 'dbitrace'); if($year && $mon) { # 1 my($empName) = param("empName"); my($year) = param("year"); my($mon) = param("mon"); if($empName) { #2 my($sth) = $dbh->prepare("select * from jobStat wh +ere cdate> '$year$mon00' AND cdate<'$year($mon++)00' AND empName='$em +pNAme'"); $sth->execute(); @arr = $sth->fetchrow_array() if(defined@arr) { #3 while(@arr=$sth->fetchrow_array()) { #4 $count++; } #4' print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display Page </ +title></head> <body> <readmore> <TABLE BORDER=1 HEIGHT=8%><TR> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>C +urrent Date</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>N +ame</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Allocated</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>A +llocation Date</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>T +arget Date</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Under Execution</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Pending </TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>R +emark </TD> </TR></table></readmore></body></html> end_of_html while(@arr=$sth->fetchrow_array()) { #5 print <<end_of_html; Content-type: text/html <html><head></head> <body><readmore> <TABLE BORDER=0 HEIGHT=8%><TR> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[5]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[8]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[1]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[6]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[7]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[2]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[3]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[4]</TD> </TR> </table> </readmore></body> </ht +ml> end_of_html } # 5' end of while(@arr=$sth->fetchrow_arra +y()) } # 3' end of if(defined@arr) else { #6 print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display Page</t +itle></head> <body> No Record found for $empName for the given dat +es.<p> <a href="/jsdisp.html" > Back </a> </body></html> end_of_html } #6' end of else for if(defined@arr) } #2' if $empName has a value else #7 if empName is null , process the query for year and m +onth { my($sth) = $dbh->prepare("select * from jobStat where + cdate> '$year$mon00' AND cdate<'$year($mon++)00'"); $sth->execute(); @arr = $sth->fetchrow_array() if(defined@arr) { #8 while(@arr=$sth->fetchrow_array()) { #9 $count++; } #9' print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display Page </ +title></head> <body><readmore> <TABLE BORDER=1 HEIGHT=8%><TR> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>C +urrent Date</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>N +ame</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Allocated</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>A +llocation Date</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='center'>T +arget Date</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Under Execution</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>J +ob Pending </TD> <TD WIDTH=15% ALIGN='middle' VALIGN='center'>R +emark </TD> </TR> </table> </body></readmore></html> end_of_html while(@arr=$sth->fetchrow_array()) { #10 # 1) id 2) ja 3) je 4)jp 5) remark 6) +cdate 7) adate 8) tdate 9) empName print <<end_of_html; Content-type: text/html <html><head></head> <body> <readmore> <TABLE BORDER=0 HEIGHT=8%><TR> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[5]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[8]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[1]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[6]</TD> <TD WIDTH=10% ALIGN='middle' VALIGN='c +enter'>$arr[7]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[2]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[3]</TD> <TD WIDTH=15% ALIGN='middle' VALIGN='c +enter'>$arr[4]</TD> </TR> </table></readmore> </body> </ht +ml> end_of_html } #10' end of while(@arr=$sth->fetchrow_ar +ray()) } # 8' end of if(defined@arr) else #else for 2nd if(defined(@arr)) { #11 print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display + Page</title></head> <body> No Record found for the given dates.<p +> <a href="/jsdisp.html" > Back </a> </body></html> end_of_html } # 11' end of else for if(defined@arr) } #7' end of else for if($empName) } #1' end of if($year && $mon) else #if month or year is not given { #12 print <<end_of_html; Content-type: text/html <html><head><title> Job Status Display Page</title></head> <bo +dy> Select year and month. <p> <a href="/jsdisp.html" > Back </a> </body></html> end_of_html } #12'

Considered by Nevtlathiel: Restore original content please, this updated question has been asked more than once in its own thread
Unconsidered by Arunbear: original content not available for restore; Keep/Edit/Delete: 4/28/1

Comment on Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
Download Code
Re: Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
by dorward (Curate) on Aug 15, 2005 at 12:44 UTC

    From perldoc perlop:

    The terminating string must appear by itself (unquoted and with no surrounding whitespace) on the terminating line.

    Don't indent your terminator.

    Better yet, ditch your here-doc and use a nice templating system (such as Template or HTML::Template) instead.

Re: Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
by davidrw (Prior) on Aug 15, 2005 at 12:48 UTC
Re: Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
by gargle (Hermit) on Aug 15, 2005 at 13:00 UTC

    I always put my end_of_html in all caps, it helps to find back the end of the here document.

    You use indentation in your here document. Your text will come out with leading spaces. If you want to get rid of the leading spaces use this:

    ($html = <<'END_OF_HTML') =~ s/^\s+//gm; Content-type: text/html <html><head></head> <body> END_OF_HTML print $html;
Re: Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
by Roger (Parson) on Aug 15, 2005 at 13:07 UTC
    The source of your problem has been pointed out so I am not going to comment on it.

    A couple of suggestions:

    1) Use the CGI module properly. Use the provided functions such as start_html, end_html, a(), popup_menu, etc...

    use CGI qw/ :all /; ... print start_html(-title=>'Job Status Display Page'), 'Select year and month.', br(), p( a({href=>"/jsdisp.html"}, "Back") ), end_html(), "\n";
    2) Have a look at tools such as HTML::Mason and Template::Toolkit. These are well proven modules for doing web programming quick and effectively.

      Good points! But don't forget the easy-to-use HTML::Template, a PM favorite.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      Template::Toolkit doesn't actually exist (I used to make this mistake until somebody corrected me). Template-Toolkit is based about the Template module.

Re: Can't find string terminator "end_of_html" anywhere before EOF at jsdisp.cgi line 37.
by izut (Chaplain) on Aug 15, 2005 at 13:08 UTC
    As said before, remove the surrounding white spaces of your terminator. Also, use <readmore> tags when your code is too long - as yours.


    Igor S. Lopes - izut
    surrender to perl. your code, your rules.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://483823]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2014-12-19 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (85 votes), past polls