blib/lib/perl5i/2/RequireMessage.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package perl5i::2::RequireMessage;
2 use strict;
3 use warnings;
4  
5 # This is the sub that displays the message
6 my $diesub = sub {
7 my ( $sub, $mod ) = @_;
8  
9 my $hints = (caller(0))[10];
10 return unless $hints->{perl5i};
11 die( <<EOT );
12 Can't locate $mod in your Perl library. You may need to install it
13 from CPAN or another repository. Your library paths are:
14 @{[ map { " $_\n" } grep { !ref($_) } @INC ]}
15 EOT
16 };
17  
18 # This sub makes sure the die sub is always at the end of @INC.
19 push @INC => sub {
20 return if ref($INC[-1]) && $INC[-1] == $diesub;
21 @INC = grep { !(ref($_) && $_ == $diesub) } @INC;
22 push @INC => $diesub;
23 };
24 push @INC => $diesub;
25  
26 1;