Config::Hierarchical::Tie::ReadOnly - Access Hierarchical configuration container through a read only hash
my $config = new Config::Hierarchical ( NAME => 'config', CATEGORY_NAMES => ['A', 'B'], DEFAULT_CATEGORY => 'B', INITIAL_VALUES => [ {CATEGORY => 'A', NAME => 'CC1', VALUE => '1'}, {CATEGORY => 'B', NAME => 'CC2', VALUE => '2'}, {CATEGORY => 'A', NAME => 'CC3', VALUE => '3'}, {CATEGORY => 'B', NAME => 'CC4', VALUE => '4'}, {CATEGORY => 'A', NAME => 'CC5', VALUE => '5'}, ] , ) ; my %hash ; tie %hash, 'Config::Hierarchical::Tie::ReadOnly' => $config ; my @keys = sort keys %hash ; # qw( CC1 CC2 CC3 CC4 CC5) print $hash{CC1} ; # print '1' $hash{CC1} = 2 ; # dies, hash is read only
Creates a read only wrapper around a Config::Hierarchical object. This let's you access the config object as a hash. You can use {} access which makes it easy to use the config in interpolated string. You can also use keys and each on the tied config.
but you can't modify the variables, clear the config or delete any variable.
This is also class is also used to allow you to link a category to an existing Config::Hierarchical object. See new in <Config::Hierarchical>.
The method invoked by the command tie %hash, class name. Associates a new hash instance with the specified class.
Dies as this tie is read only.
Retrieve the value associated with the configuration variable passed as argument
Return the first key in the hash. Used internally by Perl.
Return the next key in the hash. Used internally by Perl.
Verify that key exists within the tied Config::Hierarchical.
returns the number of elements in the tied Config::Hierarchical object.
None so far.
Khemir Nadim ibn Hamouda CPAN ID: NKH mailto:nadim@khemir.net
Copyright 2007 Khemir Nadim. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
You can find documentation for this module with the perldoc command.
perldoc Config::Hierarchical
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Config-Hierarchical
RT: CPAN's request tracker
Please report any bugs or feature requests to L <bug-config-hierarchical@rt.cpan.org>.
We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.
Search CPAN
http://search.cpan.org/dist/Config-Hierarchical
To install Config::Hierarchical, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Hierarchical
CPAN shell
perl -MCPAN -e shell install Config::Hierarchical
For more information on module installation, please visit the detailed CPAN module installation guide.