File Coverage

inc/My/Module/Recommend.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 6 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 18 35 51.4


line stmt bran cond sub pod time code
1             package My::Module::Recommend;
2              
3 1     1   5 use strict;
  1         1  
  1         26  
4 1     1   2 use warnings;
  1         6  
  1         29  
5              
6 1     1   3 use Carp;
  1         1  
  1         55  
7 1     1   337 use My::Module::Recommend::All qw{ __all };
  1         2  
  1         153  
8              
9             my @optionals = (
10             __all( 'DateTime', 'DateTime::TimeZone' => <<'EOD' ),
11             If you set the 'zone' attribute of Astro::Coord::ECI::TLE::Iridium
12             to a zone name, these modules will be used to determine if a flare
13             occurred before or after midnight. If not available, $ENV{TZ} will
14             be set to the zone name in the hope that the localtime() built-in
15             will respond to this. If the 'zone' attribute is undef (the
16             default) or a numeric offset from GMT, this module is not used.
17             EOD
18             );
19              
20             sub optionals {
21 0     0 1   return ( map { $_->modules() } @optionals );
  0            
22             }
23              
24             sub recommend {
25 0     0 1   my $need_some;
26 0           foreach my $mod ( @optionals ) {
27 0 0         defined( my $msg = $mod->recommend() )
28             or next;
29 0 0         $need_some++
30             or warn <<'EOD';
31              
32             The following optional modules were not available:
33             EOD
34 0           warn "\n$msg";
35             }
36             $need_some
37 0 0         and warn <<'EOD';
38              
39             It is not necessary to install these now. If you decide to install them
40             later, this software will make use of them when it finds them.
41              
42             EOD
43              
44 0           return;
45             }
46              
47             1;
48              
49             =head1 NAME
50              
51             My::Module::Recommend - Recommend modules to install.
52              
53             =head1 SYNOPSIS
54              
55             use lib qw{ inc };
56             use My::Module::Recommend;
57             My::Module::Recommend->recommend();
58              
59             =head1 DETAILS
60              
61             This package generates the recommendations for optional modules. It is
62             intended to be called by the build system. The build system's own
63             mechanism is not used because we find its output on the Draconian side.
64              
65             =head1 METHODS
66              
67             This class supports the following public methods:
68              
69             =head2 optionals
70              
71             say for My::Module::Recommend->optionals();
72              
73             This static method simply returns the names of the optional modules.
74              
75             =head2 recommend
76              
77             My::Module::Recommend->recommend();
78              
79             This static method examines the current Perl to see which optional
80             modules are installed. If any are not installed, a message is printed to
81             standard error explaining the benefits to be gained from installing the
82             module, and any possible problems with installing it.
83              
84             =head1 SUPPORT
85              
86             Support is by the author. Please file bug reports at
87             L or in
88             electronic mail to the author.
89              
90             =head1 AUTHOR
91              
92             Thomas R. Wyant, III F
93              
94             =head1 COPYRIGHT AND LICENSE
95              
96             Copyright (C) 2014-2022, 2026 by Thomas R. Wyant, III
97              
98             This program is free software; you can redistribute it and/or modify it
99             under the same terms as Perl 5.10.0. For more details, see the full text
100             of the licenses in the files F and F.
101              
102             This program is distributed in the hope that it will be useful, but
103             without any warranty; without even the implied warranty of
104             merchantability or fitness for a particular purpose.
105              
106             =cut
107              
108             __END__