1package ok;
2$ok::VERSION = 0.02;
3
4use strict;
5use Test::More ();
6
7sub import {
8    shift; goto &Test::More::use_ok if @_;
9
10    # No argument list - croak as if we are prototyped like use_ok()
11    my (undef, $file, $line) = caller();
12    ($file =~ /^\(eval/) or die "Not enough arguments for 'use ok' at $file line $line\n";
13}
14
15
16__END__
17
18=head1 NAME
19
20ok - Alternative to Test::More::use_ok
21
22=head1 SYNOPSIS
23
24    use ok( 'Some::Module' );
25
26=head1 DESCRIPTION
27
28With this module, simply change all C<use_ok> in test scripts to C<use ok>,
29and they will be executed at C<BEGIN> time.
30
31Please see L<Test::use::ok> for the full description.
32
33=head1 COPYRIGHT
34
35Copyright 2005, 2006 by Audrey Tang E<lt>cpan@audreyt.orgE<gt>.
36
37This software is released under the MIT license cited below.
38
39=head2 The "MIT" License
40
41Permission is hereby granted, free of charge, to any person obtaining a copy
42of this software and associated documentation files (the "Software"), to deal
43in the Software without restriction, including without limitation the rights
44to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45copies of the Software, and to permit persons to whom the Software is
46furnished to do so, subject to the following conditions:
47
48The above copyright notice and this permission notice shall be included in
49all copies or substantial portions of the Software.
50
51THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
54THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
56FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
57DEALINGS IN THE SOFTWARE.
58
59=cut
60