1package My::Module::Recommend;
2
3use strict;
4use warnings;
5
6use Carp;
7use My::Module::Recommend::Any qw{ __any };
8
9my @optionals = (
10    __any( 'PPIx::Regexp'		=> <<'EOD' ),
11      This module is needed to find variables inside nested regular
12      expressions.
13EOD
14);
15
16sub optionals {
17    return ( map { $_->modules() } @optionals );
18}
19
20sub recommend {
21    my $need_some;
22    foreach my $mod ( @optionals ) {
23	defined( my $msg = $mod->recommend() )
24	    or next;
25	$need_some++
26	    or warn <<'EOD';
27
28The following optional modules were not available:
29EOD
30	warn "\n$msg";
31    }
32    $need_some
33	and warn <<'EOD';
34
35It is not necessary to install these now. If you decide to install them
36later, this software will make use of them when it finds them.
37
38EOD
39
40    return;
41}
42
431;
44
45=head1 NAME
46
47My::Module::Recommend - Recommend modules to install.
48
49=head1 SYNOPSIS
50
51 use lib qw{ inc };
52 use My::Module::Recommend;
53 My::Module::Recommend->recommend();
54
55=head1 DETAILS
56
57This package generates the recommendations for optional modules. It is
58intended to be called by the build system. The build system's own
59mechanism is not used because we find its output on the Draconian side.
60
61=head1 METHODS
62
63This class supports the following public methods:
64
65=head2 optionals
66
67 say for My::Module::Recommend->optionals();
68
69This static method simply returns the names of the optional modules.
70
71=head2 recommend
72
73 My::Module::Recommend->recommend();
74
75This static method examines the current Perl to see which optional
76modules are installed. If any are not installed, a message is printed to
77standard error explaining the benefits to be gained from installing the
78module, and any possible problems with installing it.
79
80=head1 SUPPORT
81
82Support is by the author. Please file bug reports at
83L<https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike>,
84L<https://github.com/trwyant/perl-PPIx-QuoteLike/issues>, or in
85electronic mail to the author.
86
87=head1 AUTHOR
88
89Thomas R. Wyant, III F<wyant at cpan dot org>
90
91=head1 COPYRIGHT AND LICENSE
92
93Copyright (C) 2014-2021 by Thomas R. Wyant, III
94
95This program is free software; you can redistribute it and/or modify it
96under the same terms as Perl 5.10.0. For more details, see the full text
97of the licenses in the directory LICENSES.
98
99This program is distributed in the hope that it will be useful, but
100without any warranty; without even the implied warranty of
101merchantability or fitness for a particular purpose.
102
103=cut
104
105__END__
106
107# ex: set textwidth=72 :
108