http://www.perlmonks.org?node_id=1079441


in reply to Re: "warn" is your best friend
in thread "warn" is your best friend

You want to know my trick for that? When debugging, instead of outputting with warn $message, output messages with ::diag $message.

Advantages:

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

Replies are listed 'Best First'.
Re^3: "warn" is your best friend
by Bloodnok (Vicar) on Mar 23, 2014 at 21:58 UTC
    Hiya tobyink,

    Much as tho' I like and indeed really appreciate, your insight into debugging the test cases, I was actually referring to the use of spurious debugging statement(s) in the code itself - where my use of warn suggested that the code was even more broken than and in a different place to, the actual problem.

    A user level that continues to overstate my experience :-))

      Yes, I meant use ::diag for debugging in the module code itself; not just in the test suite!

      use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
        Aahh, I see now - at the time the leading '::' wasn't abundantly clear (as if anything ever is? :-) How on earth did you find out about that - there's nothing in the perldoc for it ?

        Awesome, ground-breaking (for me) discovery.

        Many thanx again ... tobyink++++

        A user level that continues to overstate my experience :-))