Debian Codegraph @

README

raw
1 NAME
2 recommended - Load recommended modules on demand when available
3
4 VERSION
5 version 0.003
6
7 SYNOPSIS
8 use recommended 'Foo::Bar', {
9 'Bar::Baz' => '1.23',
10 'Wibble' => '0.14',
11 };
12
13 if ( recommended->has( 'Foo::Bar' ) ) {
14 # do something with Foo::Bar
15 }
16
17 # default version required
18 if ( recommended->has( 'Wibble' ) ) {
19 # do something with Wibble if >= version 0.14
20 }
21
22 # custom version required
23 if ( recommended->has( 'Wibble', '0.10' ) ) {
24 # do something with Wibble if >= version 0.10
25 }
26
27 DESCRIPTION
28 This module gathers a list of recommended modules and versions and
29 provides means to check if they are available. It is a thin veneer
30 around Module::Runtime.
31
32 There are two major benefits over using Module::Runtime directly:
33
34 * Self-documents recommended modules together with versions at the top
35 of your code, while still loading them on demand elsewhere.
36
37 * Dies if a recommended module exists but fails to compile, but
38 doesn't die if the module is missing or the version is insufficient.
39 This is not something that Module::Runtime offers in a single
40 subroutine.
41
42 USAGE
43 import
44 use recommended 'Foo::Bar', {
45 'Bar::Baz' => '1.23',
46 'Wibble' => '0.14',
47 };
48
49 Scalar import arguments are treated as module names with a minimum
50 required version of zero. Hash references are treated as
51 module/minimum-version pairs. If you repeat, the later minimum version
52 overwrites the earlier one.
53
54 The list of modules and versions are kept separate for each calling
55 package.
56
57 has
58 recommended->has( $module );
59 recommended->has( $module, $alt_minimum_version );
60
61 The "has" method takes a module name and optional alternative minimum
62 version requirement and returns true if the following conditions are
63 met:
64
65 * the module was recommended in the current package (via "use
66 recommended")
67
68 * the module can be loaded
69
70 * the module meets the default or alternate minimum version
71
72 Otherwise, it returns false. If the module exists but fails to compile,
73 an error is thrown. This avoids some edge-cases where things are left in
74 an incomplete state or subsequent normal loads of the module by other
75 packages get a misleading error.
76
77 The module is loaded without invoking the module's "import" method, as
78 running import on an optional module at runtime is just weird.
79
80 SEE ALSO
81 * Module::Runtime
82
83 * Test::Requires
84
85 SUPPORT
86 Bugs / Feature Requests
87 Please report any bugs or feature requests through the issue tracker at
88 <https://github.com/dagolden/recommended/issues>. You will be notified
89 automatically of any progress on your issue.
90
91 Source Code
92 This is open source software. The code repository is available for
93 public review and contribution under the terms of the license.
94
95 <https://github.com/dagolden/recommended>
96
97 git clone https://github.com/dagolden/recommended.git
98
99 AUTHOR
100 David Golden <[email protected]>
101
102 COPYRIGHT AND LICENSE
103 This software is Copyright (c) 2014 by David Golden.
104
105 This is free software, licensed under:
106
107 The Apache License, Version 2.0, January 2004
108