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

Sawyer X xsawyerx at gmail.com
Sun Apr 19 12:57:26 BST 2015


Hi John,

This sounds good to me. I only have one comment:
* The DSL is available in plugins. You don't need to go to
$app->request. You can just call "request".

On Tue, Apr 14, 2015 at 8:05 PM, John Barrett <john at jbrt.org> wrote:
> 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:
>
> <https://gist.github.com/jbarrett/e568195bbb6fe5aec9ae>
>
> Secondly, is there a better or more idiomatic way to achieve this? Does
> this function already exist?
>
> Thanks.
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


More information about the dancer-users mailing list