Search code examples
perlparsingurlperl-moduleslug

Perl module to parse clean URL


I know how to create slugs for my website, so instead of URLs like this:

www.site.com/index.cgi?article=12

I create URLs like this:

www.site.com/article/12

My question is what Perl modules exist, if any, to parse these? I've done this with WSGI in Python but have no idea where to begin in Perl.


Solution

  • You're asking about parsing these URLs, but what I think you really mean is, "How do I create a web application that uses this style of URL, and easily dispatches URL calls to function calls with the right arguments?".

    If you're using one of the popular web frameworks, this will be one of the core functionalities that the framework provides:

    If you're not already using a framework, well, picking one, or even deciding if you need one at all, is a whole other question. Still, you could do worse that working through, say, the Mojolicious tutorial to see if it seems like something that would make your project easier to develop.