README.md
1# NAME
2
3Test::Requires - Checks to see if the module can be loaded
4
5# SYNOPSIS
6
7 # in your Makefile.PL
8 use inc::Module::Install;
9 test_requires 'Test::Requires';
10
11 # in your test
12 use Test::More tests => 10;
13 use Test::Requires {
14 'HTTP::MobileAttribute' => 0.01, # skip all if HTTP::MobileAttribute doesn't installed
15 };
16 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
17
18 # or
19 use Test::More tests => 10;
20 use Test::Requires qw(
21 HTTP::MobileAttribute
22 );
23 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
24
25 # or
26 use Test::More tests => 10;
27 use Test::Requires;
28 test_requires 'Some::Optional::Test::Required::Modules';
29 isa_ok HTTP::MobileAttribute->new, 'HTTP::MobileAttribute::NonMobile';
30
31# DESCRIPTION
32
33Test::Requires checks to see if the module can be loaded.
34
35If this fails rather than failing tests this **skips all tests**.
36
37Test::Requires can also be used to require a minimum version of Perl:
38
39 use Test::Requires "5.010"; # quoting is necessary!!
40
41 # or
42 use Test::Requires "v5.10";
43
44# AUTHOR
45
46Tokuhiro Matsuno <tokuhirom @\*(#RJKLFHFSDLJF gmail.com>
47
48# THANKS TO
49
50 kazuho++ # some tricky stuff
51 miyagawa++ # original code from t/TestPlagger.pm
52 tomyhero++ # reported issue related older test::builder
53 tobyink++ # documented that Test::Requires "5.010" works
54
55# ENVIRONMENT
56
57If the `RELEASE_TESTING` environment variable is true, then instead
58of skipping tests, Test::Requires bails out.
59
60# SEE ALSO
61
62["TestPlagger.pm" in t](https://metacpan.org/pod/t#TestPlagger.pm)
63
64# LICENSE
65
66This library is free software; you can redistribute it and/or modify
67it under the same terms as Perl itself.
68