sintadil has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently working on a mod_perl 2.x / SQL / PLP (I highly recommend this as a PHP replacement; hi, Juerd :)) weblogging system, and everything's working well so far. I have an etiquette question about how I'd like users to access the weblog.
What I currently have planned is to hide stuff like /comment.plp?entry=foo&id=34tvs&reply=0 by using a pseudo directory structure. What I want to do is use a PerlTransHandler to make the above URL publicly accessible with something like /comment/foo/34tvs/0. That's absolutely splendid, and it does exactly what I want. Except for one thing: AFAICT from reading the mod_perl 2.x User Guide, PerlTransHandler cannot be used anywhere except in a global server configuration context, and thus it sees many requests for things other than the weblog.
Is there a less global way to rewrite the URLs? From what I've read, mod_rewrite may be able to help me, but I'd like to try to implement the weblog with just mod_perl rather than mod_perl and mod_rewrite and mod_$foo. If there's not a less global way to rewrite the URLs, is something like the following acceptable?
sub handler { my $r = shift; if(my ($page, $entry, $id, $reply) = $r->uri =~ m#^/weblog/(co +mment|post|read)/(\w+)/(\w+)/(\d)#) { $r->uri("/$page"); $r->args("entry=$entry&id=$id&reply=$reply"); return Apache::DECLINED; } else { return Apache::DECLINED; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl weblog URL / URI question
by valdez (Monsignor) on Jul 04, 2004 at 09:26 UTC | |
|
Re: mod_perl weblog URL / URI question
by Juerd (Abbot) on Dec 18, 2004 at 12:50 UTC |