Why not create a helper that does what you need for url_for, by adding a
trailing slash in case it is missing...

### Untested code, just to get the picture
$self->app->helper(uri_for_trailed => sub { my $url =
shift->url_for(shift); $url =~ s/[^/]$/\//; return $url; });

Cheers

+rl

+rl
--
Roland Lammel
QuikIT - IT Lösungen - flexibel und schnell
Web: http://www.quikit.at
Phone: +43 (676) 9737845
Email: [email protected]

"Enjoy your job, make lots of money, work within the law. Choose any two."

On Tue, Sep 23, 2014 at 10:38 PM, Luc Didry <[email protected]> wrote:

> On 23/09/2014 10:20, Luc Didry wrote:
> > On 23/09/2014 06:18, Stefan Adams wrote:
> >> I feel like the core Plugin Mount would best address your objectives.
> >>
> >> I've built a router app based entirely on Mount that simply makes other
> >> apps available within their respective url name spaces.
> >>
> >> Hopefully that's what you're looking for!
> >
> > Seems nice but fails.
> >
> > In my router application :
> > $self->plugin('Mount' => {'/myapp' => File::Spec->catfile($Bin, '..',
> > 'script', 'application')});
> >
> > url_for('/') (or with the route name url_for('index')) still returns
> > '/myapp' and not '/myapp/' as wanted while if I don't put my app in a
> > subdirectory, url_for('/') returns '/'.
> >
> > If I mount the app under '/myapp/', the result is the same.
> >
> > I use the latest Mojolicious version (5.44) and perl 5.14.2
> >
>
> Sebastian, do you have any clue on how I could get a trailing slash in
> url_for('/') in a mounted app or in using
> http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Rewriting ?
>
> To me, it seems like a bug, but you maybe have one of your wonderful
> snippets that solves the thing :)
> --
> Luc
> http://www.fiat-tux.fr/
> Internet n'est pas compliqué, Internet est ce que vous en faites.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to