error message
Anyone know what this means: Premature end of script headers: I found it in my server error log, after I got an internal server error message when I tried to look at a new page I'd created.
Re: error message
This is what you get when you run a CGI and the cgi terminated before generating any valid output. Usually this happens if the perl script doesn't compile and therefore doesn't run. try 'perl -c script' to see if it compiles okay Gary On Tuesday 12 June 2001 2:34 pm, Sally wrote: Anyone know what this means: Premature end of script headers: I found it in my server error log, after I got an internal server error message when I tried to look at a new page I'd created. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
Re: error message
Gary Stainburn wrote: This is what you get when you run a CGI and the cgi terminated before generating any valid output. Usually this happens if the perl script doesn't compile and therefore doesn't run. try 'perl -c script' to see if it compiles okay if your script compiles without errors, then this error usually means you forgot to include the content-type header: #!/usr/bin/perl print hello worldbr; exit(); will compile, but will not send output to the browser. #!/usr/bin/perl print Content-type: text/html\n\n; print hello worldbr; exit(); will compile and run in a browser.
Re: error message
Try putting the following at the beginning of your script, it helps a lot with debugging CGI: use CGI::Carp qw/fatalsToBrowser/; Instead of getting the usual Internal Server error, it displays the error in your browser. Of course, make sure you have CGI first.
Re: Re: error message
Or maybe you could write a simple sub that catches any anomolies at run time and produces an Error message of your choosing. There is a good example of this in Chap. 5 of CGI Programming with Perl. You can also find the example from the chapter here: http://examples.oreilly.com/cgi2/ Good Luck, Mark Bergeron -Original Message- From: Geraint Jones[EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Tue Jun 12 08:23:21 PDT 2001 Subject: Re: error message Try putting the following at the beginning of your script, it helps a lot with debugging CGI: use CGI::Carp qw/fatalsToBrowser/; Instead of getting the usual Internal Server error, it displays the error in your browser. Of course, make sure you have CGI first. /~_. _ | _ _ _ _ \_/|(_||| | |(_)| | _| ___ GO.com Mail Get Your Free, Private E-mail at http://mail.go.com
javascript within print tag
i have a script that generates html. i would like to put some javascript in the head/head tags which is being generated, but escaping the javascript is a nightmare. does the print tag allow you to enter all this tedious code without escaping? if not, do i have another choice to get around this? thanks -cjm
Re: javascript within print tag
Another option is to put the JavaScript in the text file, and have Perl read from that file, and print it directly. This means you can re-use the JavaScript code in other similar script without needing to edit each script when the JavaScript need changing: open(JAVASCRIPT, javascript.js); while(JAVASCRIPT){print $_} close(JAVASCRIPT); Stephen __ Reply Separator _ Subject: javascript within print tag Author: [EMAIL PROTECTED] at Internet Date:6/12/2001 3:41 PM i have a script that generates html. i would like to put some javascript in the head/head tags which is being generated, but escaping the javascript is a nightmare. does the print tag allow you to enter all this tedious code without escaping? if not, do i have another choice to get around this? thanks -cjm
RE: javascript within print tag
Here is how I do it; #!/usr/local/bin/perl -w use CGI; print header(); print head\n, titletest script/title\n; print DONE; SCRIPT LANGUAGE=JavaScript alert('test'); /SCRIPT DONE print /head\n; cheers, Glenn Glenn Tillema [EMAIL PROTECTED] ADC Telecommunications, Inc. PO Box 1101, MS 508 Minneapolis, MN 55440-1101 Learn about ADC - The Broadband Company - www.adc.com - Original Message - From: [EMAIL PROTECTED] To: CGI Beginners Sent: Tuesday, June 12, 2001 4:41 PM Subject: javascript within print tag i have a script that generates html. i would like to put some javascript in the head/head tags which is being generated, but escaping the javascript is a nightmare. does the print tag allow you to enter all this tedious code without escaping? if not, do i have another choice to get around this? thanks -cjm
Perplexing header problem
Last week I opted to use the CGI.pm module to print headers for me since I was having trouble using print Content-type: text/html \n\n Now, I am being told that the following file is not producing a valid header. Anyone see why this might be the case? bugtrack_admin.cgi 28 lines, 1065 characters #! /usr/local/bin/perl5 -T use strict; use lib /oracle/web/docs-intranet/cgi/dispatcher/lib; use Request; use CGI qw(:standard); my $q = new CGI; my $parameter = $q-param(parameter); my $submit = $q-param(submit); print header; #here the header is being printed if ($parameter eq admin) { BugTrack-admin_details ($q-param(id)); } elsif ($submit eq Update) { BugTrack-update_request ( 'request_id' = $q-param(request_id), 'request_priority' = $q-param(request_priority), 'request_title' = $q-param(request_title), 'browser' = $q-param(browser), 'os' = $q-param(os), 'bugtrack_status' = $q-param(bugtrack_status), 'request_details' = $q-param(request_details), 'bug_domain' = $q-param(bug_domain), 'bugtrack_completion_date' = $q-param(bugtrack_completion_date), 'category' = $q-param(category), 'cause' = $q-param(cause), 'solution' = $q-param(solution), 'notes' = $q-param(notes), 'track' = $q-param(track), ); } Thanks Peter Cline Inet Developer New York Times Digital
Re: javascript within print tag
open(JAVASCRIPT, javascript.js); while(JAVASCRIPT){print $_} close(JAVASCRIPT); that's wasteful, HTML already has the script src='wherever it tis'/script tag attribute. -- justin simonihttp://skazat.com __ Steven Wright: Uh-Oh, I've lost a button-hole More: http://quotes.prolix.nu on 6/12/01 3:15 PM, WebMaster AIM-US at [EMAIL PROTECTED] wrote: Another option is to put the JavaScript in the text file, and have Perl read from that file, and print it directly. This means you can re-use the JavaScript code in other similar script without needing to edit each script when the JavaScript need changing: open(JAVASCRIPT, javascript.js); while(JAVASCRIPT){print $_} close(JAVASCRIPT); Stephen __ Reply Separator _ Subject: javascript within print tag Author: [EMAIL PROTECTED] at Internet Date:6/12/2001 3:41 PM i have a script that generates html. i would like to put some javascript in the head/head tags which is being generated, but escaping the javascript is a nightmare. does the print tag allow you to enter all this tedious code without escaping? if not, do i have another choice to get around this? thanks -cjm
RE: Circular reference
In the code you sent along you had misspelled the ACTION parameter in the form tag. (ACTON) If that is true the page will call itself and cause the nuisance. =) /Andréas Skoglund On Tue, 12 Jun 2001, Kris Cook wrote: Well, I did note that I had omitted the METHOD=POST statement. However, that didn't fix it. Oddly, adding a text field to the form solved the problem. I know that isn't necessary by HTML standards, so I am once again scrutinizing Personal Web Server as the potential culprit. Since I did need to add a couple of optioinal fields to that page in the future anyway, the quirk isn't THAT annoying, just a minor nuisance. I know. REAL web programmers use Apache. Unfortunately, most of my customers run IIS, so I try to run on PWS (Pretty Weak S***? Pathetic Weenie Server?) since it most closely approximates. I now have a Win2k platform at home with IIS running, so I can test in a better environment. BTW: In the future, try to use Reply to All to reply to the list, so others on the [EMAIL PROTECTED] list can benefit from the suggestions. -Original Message- From: Howdy! [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 9:00 PM To: Kris Cook Subject: Re: Circular reference Kris, - Original Message - Actually, this is the code for Validate.pl. Validate looks up the username and password, and if it's not found, gives the user the chance to hit the Back button and re-enter. On Continue, it sets the name of the menu to load, and goes forward to StargPage.pl, wihch simply sets up a frames page with the appropriate menu in the left frame. StartPage.pl DOES INDEED receive $nextnav. If I set up a simple form to create the hidden field and call StartPage.pl, it works: but, when it's done from Validate.pl, it re-enters Validate.pl instead of calling StartPage.pl. Most odd. Also, this is just the prototype of the finished product. It DOES need to be a form, eventually. Eventually, there will be one-way encryption on the password, and it will be compared to a stored, encrypted password. So, what I neeed is a way to validate the pairs, give the user a choice of going back or going forward, and passing the appropriate menu name to the next program. Okay, so I copied your code and reformatted it using more CGI.pm calls to run a test. I also created a StartPage.pl to receive Validate.pl's input. Everything works fine. Which leads me to wonder if your form method is using GET instead of POST. Check that and here is the code I mocked up which works fine: -- Validate.pl -- #!/perl/bin/perl use CGI qw(:standard); use strict; my $userid = param('userid'); my $passwd = param('passwd'); # Verify name and password here # If validated okay my $welcome_validated = Welcome $userid! Good to seeya! Click Continue to go on.; my $nextnav_validated = AdminMenu.htm; # If not validated okay my $welcome_not_validated = Sorry, $userid, but I don't find a matching password.BR\n. I'll have to send you in as a user, or you can click on your browser'sBR\n. STRONGBack/STRONG button and try again.BR; my $nextnav_not_validated = VisitorMenu.htm; print header, start_html, br, $welcome_validated\n, start_form(-action='StartPage.pl'), hidden(-name='nextnav',-value=$nextnav_validated), p, submit(-name='Continue'), end_form,\n\n, hr, $welcome_not_validated\n, start_form(-action='StartPage.pl'), hidden(-name='nextnav',-value=$nextnav_not_validated), p, submit(-name='Continue'), end_form, end_html; -- StartPage.pl -- #!/perl/bin/perl use CGI qw(:standard); use strict; my $nextnav = param('nextnav'); print header, start_html, You chose [$nextnav], end_html; Hope it helps!!! Joel -Original Message- From: Howdy! [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 09, 2001 11:11 AM To: Kris Cook Subject: Re: Circular reference Regarding: Circular reference, Kris Cook said I wrote a Perl script that receives a trio of parameters (DSN, user ID and password), and validates that the UserID and Passwd match a pair in the database. It then displays a message based on whether you validated, and gves you a continue button. This seems to work fine, but when you click on continue, instead of going to the next page, it re-enters the same Perl script! Of course, this time it hasn't prepared the parameters, so now it DOESN'T find the right information. I am extremely confused. The code is below: Snipped Code my $cgi= new CGI; my $dsn= $cgi-param('DSN'); my $ODBCString =
RE: javascript within print tag
--- Tillema, Glenn [EMAIL PROTECTED] wrote: Here is how I do it; #!/usr/local/bin/perl -w use CGI; print header(); print head\n, titletest script/title\n; print DONE; SCRIPT LANGUAGE=JavaScript alert('test'); /SCRIPT DONE print /head\n; As written, this script won't work. If you call the 'header()' function directly, you need to import this function from CGI. One way to do it is: use CGI qw/:standard/; Also, since you are already using CGI.pm, why not take advantage of its full functionality? #!/usr/local/bin/perl -wT use CGI qw/:standard/; use strict; print header(); my $javascript =END; SCRIPT LANGUAGE=JavaScript alert('test'); /SCRIPT END print start_html( -title = 'test script', -script = $javascript ); Note that this reads very much like the actual Web page would and is fairly easy to follow. Getting used to the built in HTML functions of CGI.pm can make the resulting HTML code much cleaner. Cheers, Curtis Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Re: Perplexing header problem
On Tue, 12 Jun 2001, Peter Cline [EMAIL PROTECTED] wrote, Last week I opted to use the CGI.pm module to print headers for me since I was having trouble using print Content-type: text/html \n\n That's good, but CGI.pm is actually not for printing header only. Now, I am being told that the following file is not producing a valid header. Anyone see why this might be the case? Did you try it? snip large code __END__ -- s::a::n-http(www.trabas.com)
How to access $ENV{UNIQUE_ID} ????????
Hi I am having trouble accessing this value. I would love to be able to use it but it does not appear to be set. I have a script written by someone else who I can no longer ask that is called from a form on my server and one of the first things it does is: my $uniqueid = $ENV{'UNIQUE_ID'}; My script called from a form on the same server does not send that environment variable. There is nothing in the form that works that can explain the difference, we are talking the same server (same directory even) everything the same. My script does not ever see the unique_id value. Why? Thanks Kevin
Re: How to access $ENV{UNIQUE_ID} ????????
Kevin Hancock wrote: Hi I am having trouble accessing this value. I would love to be able to use it but it does not appear to be set. I have a script written by someone else who I can no longer ask that is called from a form on my server and one of the first things it does is: my $uniqueid = $ENV{'UNIQUE_ID'}; you can read all about this feature of apache at http://httpd.apache.org/docs/mod/mod_unique_id.html if you're not running a recent version of apache web server, then this environment variable won't be available.
Re: How to access $ENV{UNIQUE_ID} ????????
apache also has directives to restrict env variables passed to cgi scripts. search for something like UnsetEnv in httpd.conf. search for the directives that match direcories in which both the scripts reside. something sould turn out. /kk On Wed, 13 Jun 2001, Kevin Hancock wrote: my $uniqueid = $ENV{'UNIQUE_ID'}; you can read all about this feature of apache at http://httpd.apache.org/docs/mod/mod_unique_id.html if you're not running a recent version of apache web server, then this environment variable won't be available. Thanks for the link it explains very clearly what it is. It does not solve my problem though. I have two scripts both on the same server, both in the same directory even. One has access to the UNIQUE_ID and the other does not. If it is magically part of the environment why cannot both scripts use it? Thanks Kevin