File Coverage

blib/lib/Require/HookChain/munge/prepend.pm
Criterion Covered Total %
statement 0 8 0.0
branch 0 4 0.0
condition n/a
subroutine 0 2 0.0
pod 0 2 0.0
total 0 16 0.0


line stmt bran cond sub pod time code
1             ## no critic: TestingAndDebugging::RequireUseStrict
2             package Require::HookChain::munge::prepend;
3              
4             #IFUNBUILT
5             # use strict;
6             # use warnings;
7             #END IFUNBUILT
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2023-12-05'; # DATE
11             our $DIST = 'Require-HookChain'; # DIST
12             our $VERSION = '0.016'; # VERSION
13              
14             sub new {
15 0     0 0   my ($class, $preamble) = @_;
16 0           bless { preamble => $preamble }, $class;
17             }
18              
19             sub Require::HookChain::munge::prepend::INC {
20 0     0 0   my ($self, $r) = @_;
21              
22             # safety, in case we are not called by Require::HookChain
23 0 0         return () unless ref $r;
24              
25 0           my $src = $r->src;
26 0 0         return unless defined $src; # XXX warn? or log_trace?
27              
28 0           $src = "$self->{preamble};\n$src";
29 0           $r->src($src);
30             }
31              
32             1;
33             # ABSTRACT: Prepend a piece of code to module source
34              
35             __END__