Config::General::MatchAdd < Location > and < LocationMatch > style matching to Config::General | |
Download |
Config::General::Match Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Michael Graham
- Publisher web site:
- http://search.cpan.org/~mgraham/
Config::General::Match Tags
Config::General::Match Description
Add < Location > and < LocationMatch > style matching to Config::General Config::General::Match is a Perl module that extends Config::General by providing support for configuration sections that match only for a particular file or path or URL.Typically you would use this to support the Apache-style conditional blocks, for instance: < FilesMatch .jpg$ > # ... some configuration ... < /FilesMatch > < Location /users > # ... some configuration ... < /Location > < LocationMatch .html$ > # ... some configuration ... < /LocationMatch >To read the configuration use $conf->getall_matching instead of $conf->getall: my $conf = Config::General::Match->new(...); my %config = $conf- >getall_matching('/users/joe/index.html'); my %other_config = $conf- >getall_matching('/images/banner.jpg');SYNOPSIS use Config::General::Match; my $config_text = ' < Location /users > title = "User Area" < /Location > < LocationMatch \.*(jpg|gif|png)$ > image_file = 1 < /Location > '; my $conf = Config::General::Match- >new( -String = > $config_text, -MatchSections = > , ); my %config = $conf- >getall_matching('/users/~mary/index.html'); use Data::Dumper; print Dumper(\%config); $VAR1 = { 'title' = > 'User Area', 'image_file' = > undef, }; my %config = $conf- >getall_matching('/users/~biff/images/flaming_logo.gif'); print Dumper(\%config); $VAR1 = { 'title' = > 'User Area', 'image_file' = > 1, }; Requirements: · Perl Limitations: · This module is obsolete and has now been superceded by Config::Context.
Config::General::Match Related Software