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; } }

In reply to mod_perl weblog URL / URI question by sintadil

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.