in reply to using warn instead or print STDERR?

I like to use warn instead of print STDERR if only to someday take advantage of $SIG{__WARN__}:
require Carp; $SIG{__WARN__} = sub { Carp::cluck(@_) }; # for use with debugger $SIG{__WARN__} = sub { $DB::single = 1 };

Replies are listed 'Best First'.
Re^2: using warn instead or print STDERR?
by ryanc (Monk) on Feb 27, 2009 at 00:38 UTC
    if only to someday take advantage of $SIG{__WARN__}:

    I'm curious about this now since more than one person has brought this up. By the above statement do you mean: 1) You wish to one day write code to take advantage of signal capturing, or 2) You are waiting on something to be implemented?

    TIA.
      More like 1. $SIG{__WARN__} allows me to decide what to do with my warnings at some later time, without needing to substitute every warn() call if I need things differently. See %SIG.
      # debugger, please slow down when you see keyword $SIG{__WARN__} = sub { $DB::single = $_[0] =~ /keyword/; warn(@_) }
        Very good. I took your use of the word 'someday' a bit too literally, instead of what you meant: sometime later in the running of your code.

        cheers.
        ryanc

Re^2: using warn instead or print STDERR?
by Nomad (Pilgrim) on Feb 27, 2009 at 18:20 UTC

    Bit verbose perhaps? :)

    What about:

    $SIG{__WARN__} = \&Carp::cluck;