README
1NAME
2 Test::use::ok - Alternative to Test::More::use_ok
3
4SYNOPSIS
5 use ok 'Some::Module';
6
7DESCRIPTION
8 According to the Test::More documentation, it is recommended to run
9 "use_ok()" inside a "BEGIN" block, so functions are exported at
10 compile-time and prototypes are properly honored.
11
12 That is, instead of writing this:
13
14 use_ok( 'Some::Module' );
15 use_ok( 'Other::Module' );
16
17 One should write this:
18
19 BEGIN { use_ok( 'Some::Module' ); }
20 BEGIN { use_ok( 'Other::Module' ); }
21
22 However, people often either forget to add "BEGIN", or mistakenly group
23 "use_ok" with other tests in a single "BEGIN" block, which can create
24 subtle differences in execution order.
25
26 With this module, simply change all "use_ok" in test scripts to "use
27 ok", and they will be executed at "BEGIN" time. The explicit space after
28 "use" makes it clear that this is a single compile-time action.
29
30SEE ALSO
31 Test::More
32
33CC0 1.0 Universal
34 To the extent possible under law, 唐鳳 has waived all copyright and
35 related or neighboring rights to Test-use-ok.
36
37 This work is published from Taiwan.
38
39 <http://creativecommons.org/publicdomain/zero/1.0>
40
41
README.mkdn
1# NAME
2
3Test::use::ok - Alternative to Test::More::use_ok
4
5# SYNOPSIS
6
7 use ok 'Some::Module';
8
9# DESCRIPTION
10
11According to the __Test::More__ documentation, it is recommended to run
12`use_ok()` inside a `BEGIN` block, so functions are exported at
13compile-time and prototypes are properly honored.
14
15That is, instead of writing this:
16
17 use_ok( 'Some::Module' );
18 use_ok( 'Other::Module' );
19
20One should write this:
21
22 BEGIN { use_ok( 'Some::Module' ); }
23 BEGIN { use_ok( 'Other::Module' ); }
24
25However, people often either forget to add `BEGIN`, or mistakenly group
26`use_ok` with other tests in a single `BEGIN` block, which can create subtle
27differences in execution order.
28
29With this module, simply change all `use_ok` in test scripts to `use ok`,
30and they will be executed at `BEGIN` time. The explicit space after `use`
31makes it clear that this is a single compile-time action.
32
33# SEE ALSO
34
35[Test::More](http://search.cpan.org/perldoc?Test::More)
36
37# CC0 1.0 Universal
38
39To the extent possible under law, 唐鳳 has waived all copyright and related
40or neighboring rights to L<Test-use-ok>.
41
42This work is published from Taiwan.
43
44[http://creativecommons.org/publicdomain/zero/1.0](http://creativecommons.org/publicdomain/zero/1.0)