Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: "warn" is your best friend

by Bloodnok (Vicar)
on Mar 23, 2014 at 21:58 UTC ( #1079457=note: print w/replies, xml ) Need Help??


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

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 :-))

Replies are listed 'Best First'.
Re^4: "warn" is your best friend
by tobyink (Canon) on Mar 24, 2014 at 12:45 UTC

    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 :-))

        When you do use Test::More in a test script, what you're doing is importing all Test::More's functions (including diag) into the main package, so it can be accessed as main::diag instead of Test::More::diag.

        The first paragraph of perlmod tells us that ::foo is a shorthand for main::foo.

        Thus ::diag works everywhere in your modules, provided something has happened to import Test::More into main (most likely: you are running your module through its test suite).

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2022-05-20 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?