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   4 use strict;
  1         2  
  1         25  
4 1     1   2 use warnings;
  1         7  
  1         27  
5              
6 1     1   2 use Carp;
  1         1  
  1         43  
7 1     1   350 use My::Module::Recommend::Any qw{ __any };
  1         2  
  1         151  
8              
9             my @optionals = (
10             __any( 'Clipboard' => <<'EOD' ),
11             This module is needed to exchange data with the system clipboard.
12             If you do not intend to use the copy() or paste() methods, you do
13             not need to install this module.
14             EOD
15             );
16              
17             sub optionals {
18 0     0 1   return ( map { $_->modules() } @optionals );
  0            
19             }
20              
21             sub recommend {
22 0     0 1   my $need_some;
23 0           foreach my $mod ( @optionals ) {
24 0 0         defined( my $msg = $mod->recommend() )
25             or next;
26 0 0         $need_some++
27             or warn <<'EOD';
28              
29             The following optional modules were not available:
30             EOD
31 0           warn "\n$msg";
32             }
33             $need_some
34 0 0         and warn <<'EOD';
35              
36             It is not necessary to install these now. If you decide to install them
37             later, this software will make use of them when it finds them.
38              
39             EOD
40              
41 0           return;
42             }
43              
44             1;
45              
46             __END__