CGI::URI2param - convert parts of an URL to param values
DESCRIPTION
CGI::URI2param takes a request object (as supplied by CGI.pm or
Apache::Request) and a hashref of keywords mapped to
regular expressions. It applies all of the regexes to the current URI
and adds everything that matched to the 'param' list of the request
object.
Why?
With CGI::URI2param you can instead of:
http://somehost.org/db?id=1234&style=fancy
present a nicerlooking URL like this:
http://somehost.org/db/style_fancy/id1234.html
To achieve this, simply do:
CGI::URI2param::uri2param($r,{
style => 'style_(\w+)',
id => 'id(\d+)\.html'
});
Now you can access the values like this:
my $id=$r->param('id');
my $style=$r->param('style');
If you are using mod_perl, please take a look at Apache::URI2param.
It provides an Apache PerlInitHandler to make running CGI::URI2param
easier for you. Apache::URI2param is distributed along with
CGI::URI2param.
INSTALLATION
the standard way:
perl Makefile.pl
make
make test
make install
AUTHOR
Thomas Klausner, domm@zsi.at
COPYRIGHT
CGI::URI2param is Copyright (c) 2001,2002 Thomas Klausner, ZSI.
All rights reserved.
You may use and distribute this module according to the same terms
that Perl is distributed under