1Config::MVP::Reader(3)User Contributed Perl DocumentationConfig::MVP::Reader(3)
2
3
4
6 Config::MVP::Reader - object to read config from storage into an
7 assembler
8
10 version 2.200012
11
13 use Config::MVP::Reader::YAML; # this doesn't really exist
14
15 my $reader = Config::MVP::Reader::YAML->new;
16
17 my $sequence = $reader->read_config('/etc/foobar.yml');
18
20 A Config::MVP::Reader exists to read configuration data from storage
21 (like a file) and convert that data into instructions to a
22 Config::MVP::Assembler, which will in turn convert them into a
23 Config::MVP::Sequence, the final product.
24
26 add_cwd_to_lib
27 If true (which it is by default) then the current working directly will
28 be locally added to @INC during config loading. This helps deal with
29 changes made in Perl v5.26.1.
30
32 read_config
33 my $sequence = $reader->read_config($location, \%arg);
34
35 This method is passed a location, which has no set meaning, but should
36 be the mechanism by which the Reader is told how to locate
37 configuration. It might be a file name, a hashref of parameters, a
38 DBH, or anything else, depending on the needs of the specific Reader
39 subclass.
40
41 It is also passed a hashref of arguments, of which there is only one
42 valid argument:
43
44 assembler - the Assembler object into which to read the config
45
46 If no assembler argument is passed, one will be constructed by calling
47 the Reader's "build_assembler" method.
48
49 Subclasses should generally not override "read_config", but should
50 instead implement a "read_into_assembler" method, described below. If
51 a subclass does override "read_config" it should take care to respect
52 the "add_cwd_to_lib" attribute, above.
53
54 read_into_assembler
55 This method should not be called directly. It is called by
56 "read_config" with the following parameters:
57
58 my $sequence = $reader->read_into_assembler( $location, $assembler );
59
60 The method should read the configuration found at $location and use it
61 to instruct the $assembler (a Config::MVP::Assembler) what
62 configuration to perform.
63
64 The default implementation of this method will throw an exception
65 complaining that it should have been implemented by a subclass.
66
67 build_assembler
68 If no Assembler is provided to "read_config"'s "assembler" parameter,
69 this method will be called on the Reader to construct one.
70
71 It must return a Config::MVP::Assembler object, and by default will
72 return an entirely generic one.
73
75 Ricardo Signes <rjbs@cpan.org>
76
78 This software is copyright (c) 2021 by Ricardo Signes.
79
80 This is free software; you can redistribute it and/or modify it under
81 the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.34.0 2022-01-21 Config::MVP::Reader(3)