Problems with PERL CGI

Discussion in 'Perl Misc' started by adi, Mar 31, 2006.

  1. adi

    adi Guest

    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
     
    adi, Mar 31, 2006
    #1
    1. Advertising

  2. adi

    Guest

    adi wrote:

    > 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?

    --
    http://DavidFilmer.com
     
    , Mar 31, 2006
    #2
    1. Advertising

  3. adi

    adi Guest

    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
     
    adi, Mar 31, 2006
    #3
  4. adi

    Rick Scott Guest

    (adi <> uttered:)
    > 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
    --
    key CF8F8A75 / print C5C1 F87D 5056 D2C0 D5CE D58F 970F 04D1 CF8F 8A75
    To speak much is one thing; to speak well, another.
    :Sophocles
     
    Rick Scott, Apr 1, 2006
    #4
  5. adi <> wrote:

    > 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?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 1, 2006
    #5
  6. adi

    Todd Guest

    adi wrote:
    > 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
     
    Todd, Apr 3, 2006
    #6
  7. On 2006-04-03, Todd <> wrote:

    > Perl is interpreted not compiled


    s/not/then/;

    :)

    --
    David H. Adler - <> - http://www.panix.com/~dha/
    What kind of marathon crack binge would cause you believe this?
    - Mark Rogaski
     
    David H. Adler, Apr 3, 2006
    #7
  8. David H. Adler wrote:
    > On 2006-04-03, Todd <> wrote:
    >> Perl is interpreted not compiled

    >
    > s/not/then/;


    s/(\w+) then (\w+)/$2 then $1/;

    > :)


    dito.

    hp

    --
    _ | Peter J. Holzer | Löschung von at.usenet.schmankerl?
    |_|_) | Sysadmin WSR/LUGA |
    | | | | Diskussion derzeit in at.usenet.gruppen
    __/ | http://www.hjp.at/ |
     
    Peter J. Holzer, Apr 3, 2006
    #8
  9. Todd <> wrote:
    > adi wrote:


    >> I am trying to compile a CGI code on webserver



    > 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".)


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 4, 2006
    #9
  10. adi

    adi Guest

    Tad,

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

    thanks
    adi
     
    adi, Apr 4, 2006
    #10
  11. adi

    adi Guest

    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
     
    adi, Apr 18, 2006
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jürgen Exner

    Re: CGI Perl "use CGI" statement fail

    Jürgen Exner, Jul 31, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,534
    Jürgen Exner
    Jul 31, 2003
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    729
    Michael Sparks
    Jul 30, 2005
  3. excord80
    Replies:
    17
    Views:
    795
    J Kenneth King
    Jan 29, 2009
  4. shumsta
    Replies:
    1
    Views:
    290
    Fabian Pilkowski
    Jul 22, 2005
  5. kath
    Replies:
    4
    Views:
    722
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page