31 Aug 2005 20:10:40 UTC
- Distribution: Config-Setting
- Module version: 765
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (342 / 137 / 0)
- KwaliteeBus factor: 0
- 87.34% Coverage
- License: bsd
- Activity24 month
- Download (9.83KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionHDM Dominic Mitchell
Config::Setting::Chunk - Representation of a configuration file
use Config::Setting::Chunk; my $chunk = Config::Setting::Chunk->new; $chunk->add_section( "login" ); $chunk->set_item( "login", "username", "fred" ); my @sections = $chunk->sections; my $username = $chunk->get_item( "login", "username" );
This class is a representation of a configuration file. A chunk consists of zero or more sections, each of which consists of zero or more items.
- new ( )
Class Method. Constructor.
- add_section ( SECTION )
Create a new section named SECTION. Has no effect if SECTION is already present in this chunk.
- sections ( )
Return a list of all sections in this chunk, in the order in which they were added.
- has_section ( SECTION )
Returns true or false if SECTION is present or not in this chunk.
- section_keys ( SECTION )
Returns a list of all keys present in SECTION.
- set_item ( SECTION, KEY, VALUE )
Set the item KEY to have VALUE in SECTION. if SECTION does not exist, it will be created.
- get_item ( SECTION, KEY )
Return the value of KEY in SECTION. Returns undef if KEY or SECTION does not exist.
- get ( KEY )
Return the value of KEY in the first section which contains it, or undef if no section contains it.
- to_string ( )
Returns the chunk in windows .INI style format. This may be useful for debugging.
Dominic Mitchell, <cpan (at) happygiraffe.net>
Module Install Instructions
To install Config::Setting, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Config::Setting
For more information on module installation, please visit the detailed CPAN module installation guide.