1Test::use::ok(3) User Contributed Perl Documentation Test::use::ok(3)
2
3
4
6 Test::use::ok - Alternative to Test::More::use_ok
7
9 use ok( 'Some::Module' );
10
12 According to the Test::More documentation, it is recommended to run
13 "use_ok()" inside a "BEGIN" block, so functions are exported at
14 compile-time and prototypes are properly honored.
15
16 That is, instead of writing this:
17
18 use_ok( 'Some::Module' );
19 use_ok( 'Other::Module' );
20
21 One should write this:
22
23 BEGIN { use_ok( 'Some::Module' ); }
24 BEGIN { use_ok( 'Other::Module' ); }
25
26 However, people often either forget to add "BEGIN", or mistakenly group
27 "use_ok" with other tests in a single "BEGIN" block, which can create
28 subtle differences in execution order.
29
30 With this module, simply change all "use_ok" in test scripts to "use
31 ok", and they will be executed at "BEGIN" time. The explicit space
32 after "use" makes it clear that this is a single compile-time action.
33
35 Test::More
36
38 Copyright 2005, 2006 by Audrey Tang <cpan@audreyt.org>.
39
40 This software is released under the MIT license cited below.
41
42 The "MIT" License
43 Permission is hereby granted, free of charge, to any person obtaining a
44 copy of this software and associated documentation files (the
45 "Software"), to deal in the Software without restriction, including
46 without limitation the rights to use, copy, modify, merge, publish,
47 distribute, sublicense, and/or sell copies of the Software, and to
48 permit persons to whom the Software is furnished to do so, subject to
49 the following conditions:
50
51 The above copyright notice and this permission notice shall be included
52 in all copies or substantial portions of the Software.
53
54 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
55 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
57 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
58 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
59 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
60 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61
62
63
64perl v5.12.0 2006-10-30 Test::use::ok(3)