NAME

Apache::URI2param - DEPRECATED - PerlInitHandler to use with CGI::URI2param

VERSION

version 1.03

SYNOPSIS

DEPRECATED! Please do not use this module any more!

in your httpd.conf

<Location /somewhere>
   PerlInitHandler Apache::URI2param

   PerlAddVar URI2param_regex "sort sort_(\w+)"
   PerlAddVar URI2param_regex "style style_(fancy|plain)"
   PerlAddVar URI2param_regex "id news(\d+)"
</Location>

<Location /somewhere/else>
   PerlAddVar URI2param_regex "id article(\d+)"
</Location>

DESCRIPTION

DEPRECATED! Please do not use this module any more!

Here are the old docs:

Apache::URI2param is a small PerlInitHandler to wrap around CGI::URI2param so you don't have to call CGI::URI2param::uri2param from your mod_perl scripts/apps.

As an added bonus, it uses PerlAddVar to set the regexes, so you can let Apache figure out what regexes to apply to what URIs via the Apache Configuration File.

You should start your own handlers with: sub handler { my $r=Apache::Request->instance(shift); ...

i.e., use the new feature of Apache::request, instance to use a singelton Apache Request object.

CONFIGURATION

After installing Apache::URI2param as a PerlInitHandler, you can pass regexes that should be applied to the URI via PerlAddVar. The format is:

PerlAddVar URI2param_regex "PARAM REGEX"

where PARAM is the name of the parameter to be set, and REGEX is a regular expression containing capturing parenthenses.

You should use PerlAddVar instead of PerlSetVar, because Apache will then figure out for you what regexes to apply for an given URI.

If you look at the example given in SYNOPSIS, if you'd request the URI /somewhere/else/style_fancy/article123.html you would get the following parameters:

print $r->param('style') # fancy
print $r->param('id')    # 123
print $r->param('sort')  # undef

As you can see here, you can use the "style" regex defined for /somewhere, but the "id" definition in /somewhere/else overrides the one in /somewhere.

handler()

This routine gets called as a PerlInitHandler very early in the Apache Request Cycle. Thus you can access the generated params in nearly all other phases.

handler basically just generates a hash of param names and regexes and passes the hash to CGI::URI2param::uri2param for processing there.

SEE ALSO

CGI::URI2param

AUTHOR

Thomas Klausner <domm@plix.at>

COPYRIGHT AND LICENSE

This software is copyright (c) 2001 - 2006 by Thomas Klausner.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.