Discussion:
[Mojolicious] Setting default pattern quote_end and quote_start in Mojolicious::Lite
Francesc Guasch Ortiz
2018-10-19 14:10:53 UTC
Permalink
Hi. In the module Mojolicious::Routes::Pattern the quote_end and
quote_start defaults
changed at some point.

I have some routes using "(" and ")" as quote_end and quote_start that
worked in
Mojolicious 7.59. Now those fail in newer Mojo releases. I found out the
new defaults
are "<" and ">". I can rewrite them to the new style but I steel need to
maintain those
in older servers.

I am using Mojolicious::Lite, and I was wondering if there is an easy way
to set a default
on startup or if there is another way to make both correct.

I have been researching this for a while without success, excuse me if I
missed something
obvious, please point me to a proper document if that's the case.

Thank you very much.
--
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 mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
sri
2018-10-19 14:44:56 UTC
Permalink
I believe there is no easy way to use it in that context. Those route
tokens are reconfigurable
for use with more advanced features like route shortcuts.

--
sebastian
--
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 mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Francesc Guasch Ortiz
2018-10-19 15:13:18 UTC
Permalink
Post by sri
I believe there is no easy way to use it in that context. Those route
tokens are reconfigurable
for use with more advanced features like route shortcuts.
Thank you for your quick answer, Sebastian. So I was looking to do it in
a different way with regular
expressions but I can't make them work. No matter what always fails "not
found":

If that works :

get '/messages/read/(:id).json' => sub {

shouldn't this work too ?

get qr'/messages/read/(.*).json' => sub {

I am reading the docs here:
https://mojolicious.org/perldoc/Mojolicious/Guides/Routing#Routes
I searched for more specific regular expressions for Mojolicious::Route but
I couldn't find them,
sorry if I missed them.
--
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 mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Francesc Guasch Ortiz
2018-10-21 08:25:50 UTC
Permalink
Post by sri
I believe there is no easy way to use it in that context. Those route
tokens are reconfigurable
for use with more advanced features like route shortcuts.
I have been digging inside the app variable and I think I just fixed doing
this before app->start:

my $routes = app->routes->children;
for my $route (@$routes){
$route->pattern->quote_start('(');
$route->pattern->quote_end(')');
$route->pattern->parse($route->pattern->unparsed);
}
--
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 mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Loading...