| 1 | #----------------------------------------------------------------- | ||
| 2 | # Apache::URI2param - PerlInitHandler to use with CGI::URI2param | ||
| 3 | #----------------------------------------------------------------- | ||
| 4 | # Copyright Thomas Klausner / ZSI 2002,2006 | ||
| 5 | # You may use and distribute this module according to the same terms | ||
| 6 | # that Perl is distributed under. | ||
| 7 | # | ||
| 8 | # Thomas Klausner domm@zsi.at http://domm.zsi.at | ||
| 9 | # | ||
| 10 | #----------------------------------------------------------------- | ||
| 11 | |||
| 12 | package Apache::URI2param; | ||
| 13 | |||
| 14 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | use Apache::Request 0.33 (); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 17 | use CGI::URI2param qw(uri2param); | ||
| 18 | |||
| 19 | $Apache::URI2param::VERSION = '1.01'; | ||
| 20 | |||
| 21 | sub handler { | ||
| 22 | my $r=Apache::Request->instance(shift); | ||
| 23 | my @configs = $r->dir_config->get('URI2param_regex'); | ||
| 24 | my %regexs; | ||
| 25 | my %used_keys; | ||
| 26 | |||
| 27 | foreach (@configs) { | ||
| 28 | /(\w+)\s+(.*)/; | ||
| 29 | next if $used_keys{$1}; | ||
| 30 | $regexs{$1}=$2; | ||
| 31 | $used_keys{$1}++; | ||
| 32 | } | ||
| 33 | |||
| 34 | uri2param($r,\%regexs); | ||
| 35 | |||
| 36 | return $Apache::Constants::OK; | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ | ||