Re: cgi development environment
[email protected] (Mike Williams) Wed, 19 Sep 2012 23:44:53 -0400
| Newsgroups | perl.beginners.cgi |
|---|---|
| Message-ID | <CAMi_MSv3XoO0GcvETH+p9LSAdD-XuDGV_1qN2NqqQ2Njh6g5uQ@mail.gmail.com> |
--f46d044787af6386d004ca19f364 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Sep 19, 2012 at 10:48 PM, Chris Stinemetz <[email protected]>wrote: > am having issues with my first script and have hopes someone may be > able to explain to me whey it isn't working correctly. > > The error is coming form line 11 and the error is: > > Premature end of script headers: test2.cgi > Bareword "left" not allowed while "strict subs" in use at > The error message is a major clue. Try quotes around "left" > /usr/lib/cgi-bin/test2.cgi line 7. > Execution of /usr/lib/cgi-bin/test2.cgi aborted due to compilation errors. > Premature end of script headers: test2.cgi > > > 1 #!/usr/bin/perl > 2 use warnings; > 3 use strict; > 4 use CGI; > 5 > 6 my $q = CGI->new; > 7 print $q->header(-type=>'text/html'), > 8 $q->start_html('hello world'), # start the HTML > 9 $q->h1({-align=>right},'hello world'), # level 1 header > 10 $q->h1({-align=>left}); > 11 $q->h1('some','contents'); > 12 $q->end_html; # end the HTML > > You have a couple other issues. Since you have one print statement, spread over multiple lines, the semi-colons on lines 10 and 11 are bugs. They should be commas. The semi-colons terminate the statement resulting in syntax errors. Mike --f46d044787af6386d004ca19f364--