File Coverage

blib/lib/Pod/Weaver/Config.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package Pod::Weaver::Config 4.019;
2             # ABSTRACT: stored configuration loader role
3              
4 10     10   7229 use Moose::Role;
  10         27  
  10         99  
5              
6 10     10   63248 use Config::MVP 2;
  10         1529  
  10         312  
7 10     10   4137 use Pod::Weaver::Config::Assembler;
  10         35  
  10         402  
8              
9 10     10   86 use namespace::autoclean;
  10         20  
  10         85  
10              
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod The config role provides some helpers for writing a configuration loader using
14             #pod the L<Config::MVP|Config::MVP> system to load and validate its configuration.
15             #pod
16             #pod =attr assembler
17             #pod
18             #pod The L<assembler> attribute must be a Config::MVP::Assembler, has a sensible
19             #pod default that will handle the standard needs of a config loader. Namely, it
20             #pod will be pre-loaded with a starting section for root configuration.
21             #pod
22             #pod =cut
23              
24             sub build_assembler {
25 1     1 0 61 my $assembler = Pod::Weaver::Config::Assembler->new;
26              
27 1         33 my $root = $assembler->section_class->new({
28             name => '_',
29             });
30              
31 1         2527 $assembler->sequence->add_section($root);
32              
33 1         330 return $assembler;
34             }
35              
36             1;
37              
38             __END__
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             Pod::Weaver::Config - stored configuration loader role
47              
48             =head1 VERSION
49              
50             version 4.019
51              
52             =head1 DESCRIPTION
53              
54             The config role provides some helpers for writing a configuration loader using
55             the L<Config::MVP|Config::MVP> system to load and validate its configuration.
56              
57             =head1 PERL VERSION
58              
59             This module should work on any version of perl still receiving updates from
60             the Perl 5 Porters. This means it should work on any version of perl released
61             in the last two to three years. (That is, if the most recently released
62             version is v5.40, then this module should work on both v5.40 and v5.38.)
63              
64             Although it may work on older versions of perl, no guarantee is made that the
65             minimum required version will not be increased. The version may be increased
66             for any reason, and there is no promise that patches will be accepted to lower
67             the minimum required perl.
68              
69             =head1 ATTRIBUTES
70              
71             =head2 assembler
72              
73             The L<assembler> attribute must be a Config::MVP::Assembler, has a sensible
74             default that will handle the standard needs of a config loader. Namely, it
75             will be pre-loaded with a starting section for root configuration.
76              
77             =head1 AUTHOR
78              
79             Ricardo SIGNES <cpan@semiotic.systems>
80              
81             =head1 COPYRIGHT AND LICENSE
82              
83             This software is copyright (c) 2023 by Ricardo SIGNES.
84              
85             This is free software; you can redistribute it and/or modify it under
86             the same terms as the Perl 5 programming language system itself.
87              
88             =cut