Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Config::Generic::Section
Class representing configuration sections

Config::Generic::Section - Class representing configuration sections


NAME

Config::Generic::Section - Class representing configuration sections


SYNOPSIS


 use Config::Generic;

 my $parser = new Config::Generic($grammar);

 my $config = $parser->parse($text);

 # Root is always an unnamed section

 $config->isa("Config::Generic::Section")

 # Object oriented access

 $config->get("Flag");

 # Tied access

 tie %$ref, "Config::Generic::TieWrapper",

     { Config => $config };

 $ref->{"Flag"}


DESCRIPTION

This class represents a configuration section. It is inherited from Config::Generic::Element.


METHODS

new($name, $content, $line)
Constructs a new section. $line is the line in that the directive was specified. $argument is an anonymous array holding all elements (type: Config::Generic::Element) the section contains. $name is the name of the section.

get_content([$name])
Return a reference to an array holding the contained elements.

If $name is specified, returns only those elements with that name.

set_content($content)
Sets the content of the section. $content must be an array reference. The array must contain objects of type Config::Generic::Element.

is_multiple($name, [$bunddle_nsections])
Returns true if there is more than one element in the section with the given name.

If $bunddle_nsections is true, named sections are bundled and count only as one.

Ignores the multiple mark.

make_multiple($name)
Marks the name $name as multiple. That means that even if there is only one element with this name, it is still treated as if there were multiple elements with this name.

(That means that get_element and the tied access interface would return an anonymous array)

The Config::Generic-verify()> method invokes this method during verification to ensure that MultiDirectives are treated so even if they occur only once in the configuration.

unmake_multiple($name)
Removes the multiple mark from the name $name.

Only the mark is removed, if there are really more than one elements with this name, they are still treated as multiple.

add_element($element)
Adds the given element to the section.

remove_element($element)
Remove element from the contents of the section

The multiple status can get lost, so maybe you have to call Config::Section->multiple($name) after this function.


TIED ACCESS

You can access the directive using Config::Generic::TieWrapper. See the corresponding manpage for details.


BUGS

None known yet. But they probably exist because the module is very new and untested. So please report anything suspecious you find.


TODO

Nothing :-)


SEE ALSO

the Config::Generic::Element manpage, the Config::Generic::Section manpage, the Config::Generic::Directive manpage, the Config::Generic::UnnamedSection manpage, the Config::Generic::NamedSection manpage, the Config::Generic::TieWrapper manpage, the Config::Generic::Parser manpage


AUTHOR

Nikolaus Rath, <Nikolaus@rath.org>


COPYRIGHT AND LICENSE

Copyright 2003 by Nikolaus Rath

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy