in reply to trapping "uninit" warnings to get more info

$ perl -we '$SIG{__WARN__} = sub { warn "got [@_]\n" }; $x=$x+1' got [Use of uninitialized value in addition (+) at -e line 1. ] $

Dave.

Replies are listed 'Best First'.
Re^2: trapping "uninit" warnings to get more info
by Tanktalus (Canon) on Sep 14, 2005 at 21:37 UTC

    To expand on this to make it a bit more useful:

    $SIG{__WARN__} = \&_warn_mess; sub _warn_mess { require Carp; print STDERR Carp::longmess(@_); }
    This prints out the stack trace at the point of the warning - which I think is what will help the OP the most. I know I've gotten a lot of use out of that to the point where I've put it in its own module at work and can just use it when I need the help ;-)

    Update: Missed the extra underscores on __WARN__ and the print for the longmess - thanks to Hue-Bond for alerting me