File Coverage

blib/lib/Acme/CPANModules/LoadingModules.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Acme::CPANModules::LoadingModules;
2              
3 1     1   354385 use strict;
  1         2  
  1         37  
4              
5 1     1   398 use Acme::CPANModulesUtil::Misc;
  1         525  
  1         195  
6              
7             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8             our $DATE = '2023-11-20'; # DATE
9             our $DIST = 'Acme-CPANModules-LoadingModules'; # DIST
10             our $VERSION = '0.001'; # VERSION
11              
12             my $text = <<'MARKDOWN';
13              
14             **Basics**
15              
16             is basically just a thin wrapper over Perl's builtin
17             `require()` to translate between module name and path name, since the
18             traditional behavior of `require()` is to expect module name in bareword form
19             but path name in string form. This confusion will likely be fixed in future perl
20             versions. For example, see PPC 0006 [1].
21              
22             [1]
23              
24              
25             **Installing modules automatically on demand**
26              
27             Since Perl provides require hooks, one can trap the module loading process and
28             check for an uninstalled module and attempt to install it automatically on
29             demand when a code wants to load that module. Probably not suitable for use in
30             production. See separate list: .
31              
32              
33             **Loading module on demand**
34              
35             Aside from require hook, Perl also provides the AUTOLOAD mechanism (see
36             `perlsub` documentation for more details). This lets you catch unknown function
37             being called and lets you attempt to load a module that might provide that
38             function. It is not exactly "loading modules on demand" but close enough for a
39             lot of cases. See separate list: .
40              
41              
42             **Loading multiple modules at once**
43              
44             requires all packages under a namespace. It will search the filesystem
45             for installed module source files under a specified namespace and load them all.
46              
47             loads all modules in a directory.
48              
49              
50             **Logging module loading**
51              
52            
53              
54            
55              
56              
57             **Preventing loading certain modules**
58              
59             ,
60              
61              
62             **Require hook frameworks**
63              
64             These frameworks let you create require hook more easily.
65              
66            
67              
68            
69              
70            
71              
72              
73             **Specifying relative paths**
74              
75            
76              
77             MARKDOWN
78              
79             our $LIST = {
80             summary => 'List of modules to load other Perl modules',
81             description => $text,
82             tags => ['task'],
83             };
84              
85             Acme::CPANModulesUtil::Misc::populate_entries_from_module_links_in_description;
86              
87             1;
88             # ABSTRACT: List of modules to load other Perl modules
89              
90             __END__