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.020;
2             # ABSTRACT: stored configuration loader role
3              
4 10     10   8471 use Moose::Role;
  10         56  
  10         142  
5              
6 10     10   74612 use Config::MVP 2;
  10         2408  
  10         392  
7 10     10   5245 use Pod::Weaver::Config::Assembler;
  10         165  
  10         554  
8              
9 10     10   97 use namespace::autoclean;
  10         25  
  10         126  
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 38 my $assembler = Pod::Weaver::Config::Assembler->new;
26              
27 1         24 my $root = $assembler->section_class->new({
28             name => '_',
29             });
30              
31 1         1946 $assembler->sequence->add_section($root);
32              
33 1         243 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.020
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
61             released in the last two to three years. (That is, if the most recently
62             released version is v5.40, then this module should work on both v5.40 and
63             v5.38.)
64              
65             Although it may work on older versions of perl, no guarantee is made that the
66             minimum required version will not be increased. The version may be increased
67             for any reason, and there is no promise that patches will be accepted to
68             lower the minimum required perl.
69              
70             =head1 ATTRIBUTES
71              
72             =head2 assembler
73              
74             The L<assembler> attribute must be a Config::MVP::Assembler, has a sensible
75             default that will handle the standard needs of a config loader. Namely, it
76             will be pre-loaded with a starting section for root configuration.
77              
78             =head1 AUTHOR
79              
80             Ricardo SIGNES <cpan@semiotic.systems>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is copyright (c) 2024 by Ricardo SIGNES.
85              
86             This is free software; you can redistribute it and/or modify it under
87             the same terms as the Perl 5 programming language system itself.
88              
89             =cut