4 package Module::Install::AuthorRequires;
6 use base 'Module::Install::Base';
10 our $VERSION = '0.02';
17 return $self->{values}->{author_requires}
22 my $mod = shift or last;
23 my $version = shift || 0;
24 push @added, [$mod => $version];
27 push @{ $self->{values}->{author_requires} }, @added;
28 $self->admin->author_requires(@added);
30 return map { @$_ } @added;
39 Module::Install::AuthorRequires - declare author-only dependencies
43 author_requires 'Some::Module';
44 author_requires 'Another::Module' => '0.42';
48 Modules often have optional requirements, for example dependencies that are
49 useful for (optional) tests, but not required for the module to work properly.
51 Usually you want all developers of a project to have these optional modules
52 installed. However, simply telling everyone or printing diagnostic messages if
53 optional dependencies are missing often isn't enough to make sure all authors
54 have all optional modules installed.
56 C<Module::Install> already has a way of detecting an author environment, so an
57 easy way to achieve the above would be something like:
59 if ($Module::Install::AUTHOR) {
60 requires 'Some::Module';
61 requires 'Another::Module' => '0.42';
64 Unfortunately, that'll also make the optional dependencies show up in the
65 distributions C<META.yml> file, which is obviously wrong, as they aren't
66 actually hard requirements.
68 Working that around requires a considerable amount of non-trivial Makefile.PL
69 hackery, or simply using this module's C<author_requires> command.
73 =head2 author_requires
75 author_requires $module;
76 author_requires $module => $version;
78 This declares a hard dependency, that's only enforced in author environments
79 and is not put in the generate C<META.yml> file of the distribution.
83 Florian Ragwitz E<lt>rafl@debian.orgE<gt>
85 =head1 COPYRIGHT AND LICENSE
87 Copyright (c) 2009 Florian Ragwitz
89 This is free software; you can redistribute it and/or modify it under the same
90 terms as the Perl 5 programming language system itself.