Property::Lookup::File - File-based property lookup layer
version 1.101400
use Property::Lookup; my %opt; GetOptions(\%opt, '...'); my $config = Property::Lookup->new; $config->add_layer(file => 'conf.yaml'); $config->add_layer(getopt => \%opt); $config->default_layer({ foo => 23, }); my $foo = $config->foo; # ... use Property::Lookup::Local; local %Property::Lookup::Local::opt = (bar => 'baz');
This class implements a file-based property lookup layer. It subclasses Property::Lookup::Hash but implements a custom init method - see its documentation.
init
my $layer = Property::Lookup::File->new(filename => 'conf.yaml');
If a filename has been set, it uses YAML to read that file. Before parsing it, certain substitutions are performed:
filename
The word SELF is replaced by the path to the configuration file. This way file names relative to the configuration file can be specified.
SELF
A dollar sign, followed by an identifier - one or more word characters - is replaced by its equivalent value from the %ENV hash.
%ENV
Normally you will use this layer via the add_layer() method from Property::Lookup.
add_layer()
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Property-Lookup.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Property-Lookup/.
The development version lives at http://github.com/hanekomu/Property-Lookup/. Instead of sending patches, please fork this project using the standard git and github infrastructure.
Marcel Gruenauer <marcel@cpan.org>
This software is copyright (c) 2009 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Property::Lookup, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Property::Lookup
CPAN shell
perl -MCPAN -e shell install Property::Lookup
For more information on module installation, please visit the detailed CPAN module installation guide.