|
NAMEConfig::General::Extended - Extended access to Config filesSYNOPSISuse Config::General; $conf = Config::General->new( -ConfigFile => 'configfile', -ExtendedAccess => 1 ); DESCRIPTIONThis is an internal module which makes it possible to use object oriented methods to access parts of your config file.Normally you don't call it directly. METHODS
AUTOLOAD METHODSAnother useful feature is implemented in this class using the AUTOLOAD feature of perl. If you know the keynames of a block within your config, you can access to the values of each individual key using the method notation. See the following example and you will get it:We assume the following config: <person> name = Moser prename = Peter birth = 12.10.1972 </person> Now we read it in and process it: my $conf = Config::General::Extended->new("configfile"); my $person = $conf->obj("person"); print $person->prename . " " . $person->name . " is " . $person->age . " years old\n"; This notation supports only scalar values! You need to make sure, that the block <person> does not contain any subblock or multiple identical options(which will become an array after parsing)! If you access a non-existent key this way, Config::General will croak an error. You can turn this behavior off by setting -StrictObjects to 0 or "no". In this case undef will be returned. Of course you can use this kind of methods for writing data too: $person->name("Neustein"); This changes the value of the "name" key to "Neustein". This feature behaves exactly like value() , which means you can assign hash or array references as well and that existing values under the given key will be overwritten. COPYRIGHTCopyright (c) 2000-2014 Thomas LindenThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BUGSnone known yet.AUTHORThomas Linden <tlinden |AT| cpan.org>VERSION2.07
Visit the GSP FreeBSD Man Page Interface. |