On Thu, Nov 21, 2002 at 10:34:20AM -0500, Gene Grimm wrote: > Are there any Perl modules that can help modify a configuration file > for Apache?
libapache-configfile-perl can parse apache config files. for writing them, you're on your own AFAIK (not very hard, it's plain text with a well-defined format, easy to generate). Package: libapache-configfile-perl Status: install ok installed Priority: optional Section: interpreters Installed-Size: 124 Maintainer: Michael Alan Dorman <[EMAIL PROTECTED]> Version: 1.18-1 Depends: perl (>= 5.6.0-16) Description: Parse an Apache style httpd.conf configuration file This module parses the Apache httpd.conf, or any compatible config file, and provides methods for you to access the values from the config file. there are a few other perl modules to do similar things, including: Package: libconfig-general-perl Status: install ok installed Priority: optional Section: interpreters Installed-Size: 172 Maintainer: Dagfinn Ilmari Mannsåker <[EMAIL PROTECTED]> Version: 2.09-1 Depends: perl (>= 5.6.0-16) Description: Generic Config Module This module opens a config file and parses it's contents for you. The new method requires one parameter which needs to be a filename. The method getall returns a hash which contains all options and it's associated values of your config file. . The format of config files supported by Config::General is inspired by the well known apache config format, in fact, this module is 100% compatible to apache configs, but you can also just use simple name/value pairs in your config files. . In addition to the capabilities of an apache config file it supports some enhancements such as here-documents, C-style comments or multiline options. Package: libappconfig-perl Status: install ok installed Priority: optional Section: interpreters Installed-Size: 260 Maintainer: Stefan Hornburg (Racke) <[EMAIL PROTECTED]> Source: appconfig-perl Version: 1.52-8 Depends: perl (>= 5.6.0-16) Description: Perl module for configuration file and command line parsing AppConfig is a bundle of Perl5 modules for reading configuration files and parsing command line arguments. This is a descendant of, and supersedes the App::Config module. Functionality is extended over the final version of App::Config (1.09) and includes many new features. This module has been developed and in the process, renamed, as part of an effort to unify the various Perl modules for parsing configuration files and command line arguments. > I'm looking for a method to script addition of virtual web sites (done > through mod_vhost_alias) and setting throttle values for the directory > associated with that virtual host. i recommend generating a separate config file containing your vhost definitions, with an "Include" line in httpd.conf that way, you can take the easy way out and just blow-away and regenerate your entire vhost configuration each time. much easier than parsing and modifying an existing file. i do something similar with my vhost system (i don't use mod_vhost, it's not flexible enough for my needs). i generate individual config file fragments for each virtual host, and then concatenate those fragments together to make one include file. the reason i do this is so that i can use md5sum to detect whether any of the config fragments have been hand-edited - so that my script can avoid overwriting any custom changes. if i find that i make the same custom changes for several different vhosts, i modify my scripts so that it becomes a configurable option. craig -- craig sanders <[EMAIL PROTECTED]> Fabricati Diem, PVNC. -- motto of the Ankh-Morpork City Watch -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]