Problems with PERL CGI

A

adi

Hi all,

I am trying to compile a CGI code on webserver but unfortunately have
hit some issues. For some weird reason my print messages to STDERR are
been printed to STDOUT, which in this case become the webpage.

Also, my new webpage seems to be working fine but if I refresh my page
instead of showing the HTML text it shows me the actual code.

I am not sure if above 2 problems are related but have been pulling my
hair due to these for last few days.

Any help or ideas on these would really be appreciated.
thanks
adi
 
U

usenet

adi said:
Re: Problems with PERL CGI

It's Perl, not PERL
I am trying to compile a CGI code on webserver but unfortunately have
hit some issues. For some weird reason my print messages to STDERR are
been printed to STDOUT, which in this case become the webpage.

Did you write this code yourself? Do you have something like

use CGI::Carp qw {fatalsToBrowser};

at the top of your code?
 
A

adi

Hi David,

Thanks for the correction from PERL to Perl.

The code is not written completly by me and there lies my problem
dealing with some partial legacy code. I am not using the module you
mentioned. Please let me know if you have an example which I can use as
a template.

thanks
 
R

Rick Scott

(adi said:
Also, my new webpage seems to be working fine but if I refresh my page
instead of showing the HTML text it shows me the actual code.

The HTML source, or the code of the Perl CGI script?

I've never heard of this happening only after a page is reloaded,
but usually when you see the text of a CGI program instead of its
output, it's a webserver configuration issue (and thus doesn't have
anything to do specifically with Perl). The server isn't recognizing
that the CGI program in question is a CGI program, and is serving the
file straight up instead of executing it and serving up its output.
If you're seeing HTML source instead of rendered HTML, it's usually
because the page is being sent with the wrong Content-Type header
(text/plain instead of text/html).






Rick
 
T

Tad McClellan

adi said:
Thanks for the correction from PERL to Perl.


There is a FAQ about Perl's name:

perldoc -q Perl

What's the difference between "perl" and "Perl"?

I am not using the module you
mentioned. Please let me know if you have an example which I can use as
a template.


There is code in the module's documentation, start with that:

perldoc CGI::Carp


Please also check the Perl FAQ *before* posting to the Perl newsgroup:

perldoc -q CGI

How can I get better error messages from a CGI program?
 
T

Todd

adi said:
Hi all,

I am trying to compile a CGI code on webserver but unfortunately have
hit some issues. For some weird reason my print messages to STDERR are
been printed to STDOUT, which in this case become the webpage.

Also, my new webpage seems to be working fine but if I refresh my page
instead of showing the HTML text it shows me the actual code.

I am not sure if above 2 problems are related but have been pulling my
hair due to these for last few days.

Any help or ideas on these would really be appreciated.
thanks
adi
Perl is interpreted not compiled

Check your Apache logs, you are using Apache?

Post some example code.

Are you using strict, warnings, diagnostics and CGI::Carp qw
{fatalsToBrowser};???

You can always try: perl my.cgi > /dev/null to see the errors from the
command line.


Todd
 
T

Tad McClellan

Todd said:
adi wrote:

Perl is interpreted not compiled


Perl is a floor wax AND a dessert topping! Errr, umm, I mean:

Perl is compiled AND interpreted. From perlrun.pod:

After locating your program, Perl compiles the entire program to an
internal form.

The internal form (byte codes) are then run as in an interpreter.


(I think the OP may have been looking for "execute" rather than "compile".)
 
A

adi

Tad,

Thanks a lot for your help. The perldoc was helpful in resolving the
issue.

thanks
adi
 
A

adi

All,
I had resolved this issue previously when using perl 5.8 but having
issues when using perl 5.6.1. I am trying to "carpout" all my
errors/messages to user log file. But with perl 5.6.1 , for some reason
I am getting this message printed out at top of my webpage
"Content-Type: text/html; charset=ISO-8859-1 Content-Type: text/html;
charset=ISO-8859-1".

I am not sure why I am seeing this behaviour and any help to remove
this would be erally appreciated.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top