Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: How do I...Redirect error.log data to a file of my chosing

by crazyinsomniac (Prior)
on Jun 01, 2002 at 10:16 UTC ( #170899=note: print w/replies, xml ) Need Help??


in reply to Re: How do I...Redirect error.log data to a file of my chosing
in thread How do I...Redirect error.log data to a file of my chosing

For some reason, I cannot stand to see it not written as
BEGIN { use CGI::Carp qw(carpout); carpout(\*LOGGY) if open(LOGGY,'>>'.__FILE__.'.err.log'); }
I just felt I had to share that.

update: weeeel, S_Shrum, i'd either carpout(\*STDOUT); or make warnings fatal and stick with fatalsToBrowser, like (and this works a little weird)

#!/usr/bin/perl use warnings FATAL => qw( all ); warn "hello there"; { # line 4 (notice its in a block) BAREWORD; BAREWORD; BAREWORD; }
or more portable (warnings pragma ain't available everywhere)
#!/usr/bin/perl $SIG{__WARN__} = sub {die("warning: ",@_)}; warn "hello"; __END__
or better yet
#!/usr/bin/perl use CGI::Carp qw( fatalsToBrowser ); use Fatal qw( warn ); use strict; use warnings; warn "hello";
and maybe
BEGIN { use vars qw( $WARR ); $SIG{__WARN__} = sub { $WARR .= join ' ',(@_),caller(),"\n"; }; } warn "hello"; warn "hooyah"; die "aaah"; # ... END { print "Content-Type: text-html\r\n\r\n <pre> $WARR </pre>"; }
Reccomended reading is warnings, perllexwarn, sigtrap, Perl's Warn and Die Signals.

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Replies are listed 'Best First'.
Re: Re: Re: How do I...Redirect error.log data to a file of my chosing
by Beatnik (Parson) on Jun 01, 2002 at 10:23 UTC
    Your choice ofcourse :) the CGI::Carp POD mentioned the above example :)

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
Re: Re: Re: How do I...Redirect error.log data to a file of my chosing
by S_Shrum (Pilgrim) on Jun 03, 2002 at 01:23 UTC

    This works great...

    I'm finding that having to run my script, having it fail, going to the log file, openning it, scrolling to the bottom is just too time consuming. How can I carpout to the browser for faster debugging?

    ======================
    Sean Shrum
    http://www.shrum.net

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2019-08-22 03:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?