Echoing fatal errors in Unix vs. Windows

Discussion in 'Perl Misc' started by Bob, Sep 9, 2005.

  1. Bob

    Bob Guest

    Ok... I'm a windows guy and woefully weak in Unix skills.

    WHen I run a script on my windows IIS server, and Perl script
    errors (e.g. coding problems) get echoed back to the browser.
    When I load the same programs on my ISP's Linux server, I
    get "Internal Server Error, see log". Unfortunately, I don't
    seem to have access to that log file in my virtual environment.

    I assume this has something to do with std err vs. std out and
    where that output goes - but that's about the limit of my Unix
    knowledge. How can I redirect the error output to dump back to
    the browser ?

    Thanks,
     
    Bob, Sep 9, 2005
    #1
    1. Advertising

  2. Bob a écrit :
    > Ok... I'm a windows guy and woefully weak in Unix skills.
    >
    > WHen I run a script on my windows IIS server, and Perl script
    > errors (e.g. coding problems) get echoed back to the browser.
    > When I load the same programs on my ISP's Linux server, I
    > get "Internal Server Error, see log". Unfortunately, I don't
    > seem to have access to that log file in my virtual environment.
    >
    > I assume this has something to do with std err vs. std out and
    > where that output goes - but that's about the limit of my Unix
    > knowledge. How can I redirect the error output to dump back to
    > the browser ?
    >
    > Thanks,


    Hi use
    print "Content-type: image/html\n\n";
    print "$var";
     
    Alexandre Jaquet, Sep 9, 2005
    #2
    1. Advertising

  3. Bob

    Scott Bryce Guest

    Scott Bryce, Sep 9, 2005
    #3
  4. Alexandre Jaquet, Sep 9, 2005
    #4
  5. Bob

    Scott Bryce Guest

    Alexandre Jaquet > wrote:

    > It will be better to use
    >
    > print "Content-type: text/html\n\n";
    > print "$var";


    How would this cause fatal errors to be echoed in the browser?
     
    Scott Bryce, Sep 9, 2005
    #5
  6. Bob

    Tintin Guest

    "Alexandre Jaquet" <""alexjaquet\"@[no spam]msn.com"> wrote in message
    news:Ob9Ue.31774$...
    > Scott Bryce a écrit :
    >> Bob wrote:
    >>
    >>> How can I redirect the error output to dump back to the browser ?

    >>
    >>
    >> http://search.cpan.org/~lds/CGI.pm-3.11/CGI/Carp.pm
    >> http://search.cpan.org/~lds/CGI.pm-3.11/CGI/Carp.pm#MAKING_PERL_ERRORS_APPEAR_IN_THE_BROWSER_WINDOW

    >
    > It will be better to use
    >
    > print "Content-type: text/html\n\n";
    > print "$var";


    You have a bizzare definition of "better".

    See what happens when you try running the following 2 Perl CGI scripts and
    then tell me which is better.

    #!/usr/bin/perl
    use strict;
    use CGI;

    my $q = new CGI;
    print $q->header;
    print $q->h1("Hello World");
    stuffup=foobar;

    #!/usr/bin/perl
    use strict;
    use CGI;
    use CGI::Carp qw(fatalsToBrowser);

    my $q = new CGI;
    print $q->header;
    print $q->h1("Hello World");
    stuffup=foobar;
     
    Tintin, Sep 9, 2005
    #6
  7. Bob <> wrote:


    > How can I redirect the error output to dump back to
    > the browser ?



    perldoc -q error

    My CGI script runs from the command line but not the browser. (500
    Server Error)

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


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Sep 9, 2005
    #7
  8. Bob

    Joe Smith Guest

    Alexandre Jaquet > wrote:
    > Bob a écrit :
    >
    >> Ok... I'm a windows guy and woefully weak in Unix skills.
    >> WHen I run a script on my windows IIS server, and Perl script
    >> errors (e.g. coding problems) get echoed back to the browser. When I
    >> load the same programs on my ISP's Linux server, I get "Internal
    >> Server Error, see log". Unfortunately, I don't
    >> seem to have access to that log file in my virtual environment.
    >> I assume this has something to do with std err vs. std out and where
    >> that output goes - but that's about the limit of my Unix
    >> knowledge. How can I redirect the error output to dump back to the
    >> browser ?
    >> Thanks,

    >
    >
    > print "Content-type: image/html\n\n";
    > print "$var";


    That is so very wrong.
    *) "image/html" is gibberish
    *) The print() statement will not be executed if there is an
    error that causes perl to abort.

    The other people answering Bob's question have it right.
    -Joe
     
    Joe Smith, Sep 11, 2005
    #8
    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. Dave
    Replies:
    0
    Views:
    947
  2. Replies:
    1
    Views:
    382
    [Si]dragon
    Apr 11, 2006
  3. Replies:
    2
    Views:
    171
  4. still me
    Replies:
    0
    Views:
    91
    still me
    Oct 18, 2007
  5. Matthew Pulis

    Echoing from a Script

    Matthew Pulis, Dec 16, 2007, in forum: Javascript
    Replies:
    2
    Views:
    105
    ZeldorBlat
    Dec 17, 2007
Loading...

Share This Page