The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IRC::Indexer::Conf - Handle Indexer configuration files

SYNOPSIS

  my $cfhash = IRC::Indexer::Conf->parse_conf($path);
  
  ## Recursively read server spec files:
  my $nethash = IRC::Indexer::Conf->parse_nets($specfile_dir);

DESCRIPTION

Handles IRC::Indexer configuration files in YAML format.

This module can also generate example configuration files.

METHODS

Methods can be called as either class or object methods.

parse_conf

Takes either a file path or a previously-opened filehandle.

Read and parse a specified YAML configuration file, returning the deserialized contents.

parse_conf will croak() if the path cannot be read or does not contain YAML.

YAML::XS will throw an exception if the YAML is not valid.

parse_nets

Takes either a directory or an array reference containing a previously-discovered list of server spec files.

Calls "find_nets" to discover server spec files.

  IRC::Indexer::Conf->parse_nets($spec_dir);
  IRC::Indexer::Conf->parse_nets(\@specfiles);

Returns a hash with the following structure:

  $NETWORK => {
    $ServerA => $spec_file_hash,
  }

find_nets

Locate .server spec files recursively under a specified directory.

  my @specfiles = IRC::Indexer::Conf->find_nets($spec_dir);

Returns an array in list context or an array reference in scalar context.

get_example_cf

Returns the raw YAML for an example configuration file.

  IRC::Indexer::Conf->get_example_cf('httpd');

Valid types, as of this writing, are:

  httpd
  spec

write_example_cf

Writes an example configuration file to a specified path.

  IRC::Indexer::Conf->write_example_cf('httpd', $path);
  
  ## From a shell, perhaps:
  $ perl -MIRC::Indexer::Conf -e \
    'IRC::Indexer::Conf->write_example_cf("httpd", "myhttpd.cf")'

See "get_example_cf" for a list of valid types.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>