Config::ContextAdd < Location > and < LocationMatch > style context matching to hierarchical configfile formats such as Config::General, XML::Simple and Config::Scoped | |
Download |
Config::Context Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Michael Graham
- Publisher web site:
- http://search.cpan.org/~mgraham/
Config::Context Tags
Config::Context Description
Add < Location > and < LocationMatch > style context matching to hierarchical configfile formats such as Config::General, XML::Simple and Config::Scoped Config::Context is a Perl module that provides a consistent interface to many hierarchical configuration file formats such as Config::General, XML::Simple and Config::Scoped.It also provides Apache-style context matching. You can include blocks of configuration that match or not based on run-time parameters.For instance (using Config::General syntax): company_name = ACME in_the_users_area = 0 < Location /users > in_the_users_area = 1 < /Location >At runtime, if Location is within /users, then the configuration within the block is merged into the top level. Otherwise, the block is ignored.So if Location is /users/gary, the configuration is reduced to: { company_name => 'ACME', in_the_users_area => 1, }But if Location is outside of the /users area (e.g. /admin/documents.html), the configuration is reduced to: { company_name => 'ACME', in_the_users_area => 0, }The exact mechanics of how Location matches /users is extensively customizable. You can configure a particular block to match based on exact string matches, a substring, a path, or a regex.This kind of context-based matching was inspired by Apache's context-based configuration files.Config::Context works with Apache-style config files (via Config::General), XML documents (via XML::Simple), and Config::Scoped config files. You select the type config file with the driver option to new.The examples in this document use Config::General (Apache-style) syntax. For details on other configuration formats, see the documentation for the appropriate driver.For a real world example of Config::Context in action, see CGI::Application::Plugin::Config::Context, which determines configurations based on the URL of the request, the name of the Perl Module, and the virtual host handling the web request. Requirements: · Perl
Config::Context Related Software