#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    247

    CGI::Carp fatals not showing in browser


    Hi,

    Does anyone know how to get
    Code:
    use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
    to work with the new versions of ActivePerl

    I'm using v5.14 and it seems if you issue a 'die' command or there is a compile error, they are no longer outputted to the browser making debugging a complete nightmare.

    It seems nothing gets outputted to the browser other than a 'Server error 500' unless a header is printed first?

    Help getting fatals to browser working again is very much appreciated.

    Regards,
    1DMF
    Last edited by 1DMF; June 7th, 2012 at 05:25 AM.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    I'm currently running 5.12, but have been thinking about upgrading, so give me a little time and I'll do that and try to duplicate your issue.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    Here's what I found.

    1) Works as expected on compile errors

    2) Works as expected on die statements

    3) Fails if output is sent to STDOUT prior to sending the html header

    4) Partial failure - if non fatal output is sent to STDERR prior to sending the header, the error log is updated correctly, but not the output to the browser. I believe this is actually the same behavior as before.

    I have not compared the source code with prior versions, but, it appears to me that the module has been updated and a portion of it is now broken.

    Looks like it's time to file a bug report to have the author fix the module.
    Last edited by FishMonger; June 7th, 2012 at 03:32 PM.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    247
    Hey FishMonger,

    How on earth are you getting compile errors to show?

    or any 'die' command without printing a header, it does not work for me!

    What version of IIS are you running?

    could this be part of the equasion.

    Can you provide me a code example where 'die' and a compile error is outputted to browser, so I can test.


    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    I don't use IIS, I use apache. Since you're seeing slightly different results, the web server itself could also be a factor. M$ is not very good at following industry standards. They make up their own standards and wants the industry to follow them.

    Prior versions of the module would handle the outputting of the header, if it had not already been done, so that it could properly handle the outputting of compilation errors.

    This version is not consistent in that functionality, so submitting a bug report would be the appropriate thing to do. I did a little google searching on this issue and it's not new. I found cases that were 5 to 10 years old. So, it appears that the problem had been fixed, but recent updates have broken it again.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    I did not save my test script from yesterday, so I made a new one and this one produces the proper results in all cases. I must have goofed up something in my prior test.

    Here's my test code. You can comment/uncomment lines as needed to see results from each case.

    Code:
    #!c:/perl/bin/perl
    
    use strict;
    use warnings;
    use CGI qw(:standard);
    use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
    
    use NoGood;
    
    #print header();
    #warningsToBrowser(1);
    
    #warn "did this go the the log file and browser?";
    
    #open my $fh, '<', 'badfile' or die "open failed $!";
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    247
    Sorry FishMonger I thought ActivePerl was the Windows only version of perl from Active State.

    I didn't mean to confuse anyone, I've always associated ActiveState as a Windows platform!

    This is on windows 2008 R2 with IIS7

    When I test your code all I get is '500 - Internal server error'... very frustrating indeed!

    I know it should give me the can't find module error, but it doesn't!

    How do I fix this?
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,954
    Rep Power
    1225
    I suspect that IIS is intercepting the output and doing its own thing.

    The best way to find out if this is the case would be to install apache and run the same test. If you get the same results, then the problem is probably with the module. If you get the proper expected results, then you know the problem is with IIS. I don't know how to fix IIS.
  16. #9
  17. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    247
    I don't want to load apache on this box, so it isn't an option.

    It worked fine on IIS6 with ActivePerl v5.8 :-(

    Maybe I need to ask in the IIS forums?
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!

IMN logo majestic logo threadwatch logo seochat tools logo