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.200001
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 read_config
27 my $sequence = $reader->read_config($location, \%arg);
28
29 This method is passed a location, which has no set meaning, but should
30 be the mechanism by which the Reader is told how to locate
31 configuration. It might be a file name, a hashref of parameters, a
32 DBH, or anything else, depending on the needs of the specific Reader
33 subclass.
34
35 It is also passed a hashref of arguments, of which there is only one
36 valid argument:
37
38 assembler - the Assembler object into which to read the config
39
40 If no assembler argument is passed, one will be constructed by calling
41 the Reader's "build_assembler" method.
42
43 Subclasses should generally not override "read_config", but should
44 instead implement a "read_into_assembler" method, described below.
45
46 read_into_assembler
47 This method should not be called directly. It is called by
48 "read_config" with the following parameters:
49
50 my $sequence = $reader->read_into_assembler( $location, $assembler );
51
52 The method should read the configuration found at $location and use it
53 to instruct the $assembler (a Config::MVP::Assembler) what
54 configuration to perform.
55
56 The default implementation of this method will throw an exception
57 complaining that it should have been implemented by a subclass.
58
59 build_assembler
60 If no Assembler is provided to "read_config"'s "assembler" parameter,
61 this method will be called on the Reader to construct one.
62
63 It must return a Config::MVP::Assembler object, and by default will
64 return an entirely generic one.
65
67 Ricardo Signes <rjbs@cpan.org>
68
70 This software is copyright (c) 2011 by Ricardo Signes.
71
72 This is free software; you can redistribute it and/or modify it under
73 the same terms as the Perl 5 programming language system itself.
74
75
76
77perl v5.12.3 2011-02-11 Config::MVP::Reader(3)