Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Getting error messages from IIS with PerlScript

by krisahoch (Deacon)
on Aug 09, 2005 at 14:48 UTC ( #482229=note: print w/replies, xml ) Need Help??


in reply to Re: Getting error messages from IIS with PerlScript
in thread Getting error messages from IIS with PerlScript

ikegami,
Here is what I have tried already.
<%@Language=PerlScript%> <% use strict; use Win32::ASP; use vars qw($Response $Request $Server); # Turn on buffering...allows us # to send headers whenever we want. $Response->{Buffer} = 1; # turn OFF page caching. This will hopefully # fix some of IIS's HORRIBLE shortcomings. $Response->{Expires} = 0; $Response->AddHeader('pragma', 'no-cache'); $Response->AddHeader('cache-control','private'); $SIG{__DIE__} = sub { $Response->Write("<h1>Death!</h1>"); }; $SIG{__WARN__} = sub { $Response->Write("<h1>Warning!</h1>"); }; %> <%= my $bad_value = 4/0 %>
And here is what it begets (in the Browser window only, nothing in logs.
PerlScript Error error '80004005' (in cleanup) Illegal division by zero /index.asp, line 18

I am trying to capture that output and throw it to an error log. The problem is that I haven't been about to capture it. If matters weren't bad enough, I have no access to the administration of the host server. I can only access my directory (Global.asa is not an option).

Thank you,
Kristofer Hoch

Replies are listed 'Best First'.
Re^3: Getting error messages from IIS with PerlScript
by ikegami (Patriarch) on Aug 09, 2005 at 14:58 UTC

    You said you wanted to log the errors, not send them to the client. I think the handlers are getting called, and you can log the errors from within them.

    If you want to send the error to the client, you'll either need to do some fancy ASP stuff, or use eval BLOCK. For example,

    eval { ... something_that_might_die(); ... }; if ($@) { # It died. # The error message is in $@ ... }

    That won't catch division by zero, but it will catch just about everything else. To catch division by zero, check the denominator before dividing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482229]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-05-16 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (62 votes). Check out past polls.

    Notices?