File Coverage

lib/Test/use/ok.pm
Criterion Covered Total %
statement 2 2 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 3 3 100.0


line stmt bran cond sub pod time code
1             package Test::use::ok;
2 1     1   496 use 5.005;
  1         5  
3              
4             our $VERSION = '1.302182';
5              
6              
7             __END__
8              
9             =head1 NAME
10              
11             Test::use::ok - Alternative to Test::More::use_ok
12              
13             =head1 SYNOPSIS
14              
15             use ok 'Some::Module';
16              
17             =head1 DESCRIPTION
18              
19             According to the B<Test::More> documentation, it is recommended to run
20             C<use_ok()> inside a C<BEGIN> block, so functions are exported at
21             compile-time and prototypes are properly honored.
22              
23             That is, instead of writing this:
24              
25             use_ok( 'Some::Module' );
26             use_ok( 'Other::Module' );
27              
28             One should write this:
29              
30             BEGIN { use_ok( 'Some::Module' ); }
31             BEGIN { use_ok( 'Other::Module' ); }
32              
33             However, people often either forget to add C<BEGIN>, or mistakenly group
34             C<use_ok> with other tests in a single C<BEGIN> block, which can create subtle
35             differences in execution order.
36              
37             With this module, simply change all C<use_ok> in test scripts to C<use ok>,
38             and they will be executed at C<BEGIN> time. The explicit space after C<use>
39             makes it clear that this is a single compile-time action.
40              
41             =head1 SEE ALSO
42              
43             L<Test::More>
44              
45             =head1 MAINTAINER
46              
47             =over 4
48              
49             =item Chad Granum E<lt>exodist@cpan.orgE<gt>
50              
51             =back
52              
53             =encoding utf8
54              
55             =head1 CC0 1.0 Universal
56              
57             To the extent possible under law, 唐鳳 has waived all copyright and related
58             or neighboring rights to L<Test-use-ok>.
59              
60             This work is published from Taiwan.
61              
62             L<http://creativecommons.org/publicdomain/zero/1.0>
63              
64             =cut