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::Directive
Class representing configuration directives

Config::Generic::Directive - Class representing configuration directives


NAME

Config::Generic::Directive - Class representing configuration directives


SYNOPSIS


 use Config::Generic;

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

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

 # Flag should be a directive, of course

 # $config->get("Flag")->isa("Config::Generic::Directive")

 # Object oriented access

 $directive = $config->get("Flag");

 $directive->get_argument(1);

 $directive->set_argument("foo", 2);

 # Tied access

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

     { Config => $config,

       TieDirectives => "no" };

 $ref->{"Flag"}->get_argument(1);

 # or

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

     { Config => $config,

       TieDirectives => "yes" };

 $ref->{"Flag"}->[1]; # Second argument


DESCRIPTION

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


METHODS

new($name, $argument, $line)
Constructs a new directive. $line is the line in that the directive was specified. $argument is an anonymous array holding all arguments of the directive. $name is the name.

has_multiple_args
Returns true if the directive has more than one argument

get_argument([$index])
Return a reference to an array holding the arguments if no parameter was given.

Else return the requested argument.

set_argument($value, [$index])
If $index was given: Set the specified argument to this value.

Else: Set the argument list to this value ($value must be an arrayref)

as_string
Can only be called if the directive has only 1 argument. Returns the argument.

This method is used to overload the string interpolation, so you can do


 print $object

to print the argument


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