[Catalyst] Regex -- optional index.html

Bill Moseley moseley at hank.org
Fri Mar 2 17:59:48 GMT 2007


On Thu, Mar 01, 2007 at 04:13:05PM -0800, Bill Moseley wrote:
> Seems that Catalyst first tries to match the full path, then tries to
> match a reduced path.  Adding a bit of debugging to Regex.pm's match()
> method:
> 
>     Request = /training/webcasts/webcast_data/162/foo.html
> 
>     Checking [training/webcasts/webcast_data/162/foo.html]
>     Checking [training/webcasts/webcast_data/162]
>     *MATCHED*

Ok, so is that a bug?  Or am I not understanding the docs?

    # Regex

        sub bar : Regex('^item(\d+)/order(\d+)$') { }

    Matches any URL that matches the pattern in the action key, e.g.
    http://localhost:3000/item23/order42. The '' around the regexp is
    optional, but perltidy likes it. :)

So it seems that would also match:

    http://localhost:3000/item23/order42/something.else

but the "$" would indicate to me that it much only match the shorter
string.


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list