update Tue May 4 18:37:00 PDT 2010
[pkgsrc.git] / devel / p5-Test-use-ok / DESCR
1 According to the Test::More documentation, it is recommended to run
2 use_ok() inside a BEGIN block, so functions are exported at
3 compile-time and prototypes are properly honored.
4
5 That is, instead of writing this:
6
7     use_ok( 'Some::Module' );
8     use_ok( 'Other::Module' );
9
10 One should write this:
11
12     BEGIN { use_ok( 'Some::Module' ); }
13     BEGIN { use_ok( 'Other::Module' ); }
14
15 However, people often either forget to add BEGIN, or mistakenly group
16 use_ok with other tests in a single BEGIN block, which can create subtle
17 differences in execution order.
18
19 With this module, simply change all use_ok in test scripts to use ok,
20 and they will be executed at BEGIN time.  The explicit space after use
21 makes it clear that this is a single compile-time action.