Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: RFC: Tutorial "Introspecting your Moose code using Test Point Callbacks"

by ait (Friar)
on Jan 02, 2011 at 18:23 UTC ( #880088=note: print w/replies, xml ) Need Help??

in reply to Re: RFC: Tutorial "Introspecting your Moose code using Test Point Callbacks"
in thread RFC: Tutorial "Introspecting your Moose code using Test Point Callbacks"

Thank you for your feedback.

As I point out to ELISHEVA in a lengthy response above, I am using this technique specifically to test parts of a method, not at all to supply a call-back mechanism or pre/post/around hooks of any sort (which BTW are already provided by Moose). The idea is to inspect intermediate results in a single function, much like many times you leave a DB breakpoint, a commented warn statement, or a debug-level log statement, is probably because you anticipate having problems there in the future, or because these intermediate results may help you to debug this code if a test fails.

Rationale: whenever you have the need to print a debug statement, or use the debugger, is is not better to write a sub-test case with this call-back technique?

Of course this may only apply to complex functions that cannot be factorized into smaller chunks, for example long nested conditionals, etc. If you don't use these callbacks they don't really hurt and could even be wrapped with a 'diagnostic' testing mode for example. So you can run your basic tests, and if the fail, you could run a more thorough 'diagnostic' test that uses the callbacks to evaluate intermediate results.

  • Comment on Re^2: RFC: Tutorial "Introspecting your Moose code using Test Point Callbacks"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://880088]
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on looking at a module,
[atcroft]: and it referred to several other modules, but the links went to I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-05-27 03:54 GMT
Find Nodes?
    Voting Booth?