Sphinx::Config.3pm

Langue: en

Version: 2007-09-13 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

NAME

Sphinx::Config - Sphinx search engine configuration file read/modify/write

VERSION

Version 0.01

SYNOPSIS

     use Sphinx::Config;
 
 
     my $c = Sphinx::Config->new();
     $c->parse($filename);
     $path = $c->get('index', 'test1', 'path');
     $c->set('index', 'test1', 'path', $path);
     $c->save($filename);
     ...
 
 

CONSTRUCTOR


new

     $c = Sphinx::Config->new;
 
 

METHODS


parse

     $c->parse($filename)
 
 

Parse the given Sphinx configuration file.

Dies on error.

config

     $config = $c->config;
 
 

Get the parsed configuration data as an array of hashes, where each entry in the array represents one section of the configuration, in the order as parsed or constructed.

Each section is described by a hash with the following keys:

* _type A mandatory key describing the section type (index, searchd etc)
* _name The name of the section, where applicable
* _inherited The name of the parent section, where applicable
* _data A hash containing the name/value pairs which hold the configuration data for the section.

get

     $value = $c->get($type, $name, $varname)
     $value = $c->get($type, $name)
 
 

Get the value of a configuration parameter.

If $varname is specified, the value of the named parameter from the section identified by the type and name is returned as a scalar. Otherwise, the hash containing all key/value pairs from the section is returned.

$name may be undef for sections that do not require a name (e.g. searchd, indexer, search).

If the section cannot be found or the named parameter does not exist, undef is returned.

set

     $c->set($type, $name, $varname, $value)
     $c->set($type, $name, \%values)
 
 

Set the value or values of a section in the configuration.

If varname is given, then the single parameter of that name in the given section is set to the specified value.

If a hash of name/value pairs is given, then any existing values are replaced with the given hash.

If the section does not currently exist, a new one is appended.

Returns the hash containing the current data values for the given section.

as_string

     $s = $c->as_string
     $s = $c->as_string($comment)
 
 

Returns the configuration as a string, optionally with a comment prepended.

The comment is inserted literally, so each line should begin with '#'.

save

     $c->save
     $c->save($filename, $comment)
 
 

Save the configuration to a file.

The comment is inserted literally, so each line should begin with '#'.

SEE ALSO

Sphinx::Search

AUTHOR

Jon Schutz, "<jon at jschutz.net>"

BUGS

Please report any bugs or feature requests to "bug-sphinx-config at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sphinx-Config>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.
     perldoc Sphinx::Config
 
 

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/Sphinx-Config>
* CPAN Ratings
<http://cpanratings.perl.org/d/Sphinx-Config>
* RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sphinx-Config>
* Search CPAN
<http://search.cpan.org/dist/Sphinx-Config>

ACKNOWLEDGEMENTS

Copyright 2007 Jon Schutz, all rights reserved.

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