[dancer-users] Proposed plugin Dancer2::Plugin::RootURIFor

John Barrett john at jbrt.org
Tue Apr 14 19:05:43 BST 2015

Hey all,

Following some discussion on #dancer today, I have a couple of
questions. Firstly, before I go ahead and wrap this in tests and
CPAN-ify it, does it seem useful?

Dancer2::Plugin::RootURIFor provides root_uri_for, which is the same as
uri_for except it ignores your application's mount point / base path.
The use-case for this is if you have multiple applications and would
like to construct links between them (or to other resources) which
retain URI scheme, host, port etc.

e.g. You have two apps, mounted on /app1 and /app2. Calling:

uri_for '/app2'

...from app1 will give you 'http://.../app1/app2'. Calling:

root_uri_for '/app2'

...from app1 will give you 'http://.../app2'.

First pass:


Secondly, is there a better or more idiomatic way to achieve this? Does
this function already exist?


More information about the dancer-users mailing list