[Dancer-users] Matching a route including slashes (for directory listing)

sawyer x xsawyerx at gmail.com
Sun Jan 30 13:25:53 CET 2011


On Sun, Jan 30, 2011 at 2:21 PM, Al Newkirk & Associates <we at ana.im> wrote:

> On Sun, Jan 30, 2011 at 5:05 AM, sawyer x <xsawyerx at gmail.com> wrote:
>
>> On Sun, Jan 30, 2011 at 11:46 AM, Joel Roth <joelz at pobox.com> wrote:
>>
>> Hey Joel,
>>
>> If you know the level, and you want to be explicit, you can try the
>> default route syntax: '/media/*/*'.
>> However, you will most likely prefer a regular expression (which you tried
>> earlier), and Dancer allows that very easily since Perl considers regexes as
>> first class:
>> get qr/.../ => sub { ... };
>>
>> We prefer to wrap qr() with something other than slashes, so we don't get
>> into a backslash fight:
>> get qr{ / media / (.*) }x => sub { ... };
>>
>> Enjoy!
>>
>>
> I feel compelled to caution about how the use of regexs can open security
> holes in your application.
> Another way to go would be to traverse the directory(s) and generate routes
> based on the findings in a before action.
>

That's a good point and a good idea!

Thanks, Al!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110130/acfdc6f3/attachment.htm>


More information about the Dancer-users mailing list