Why not just hard-code %url_params? Often it will be a lot more obvious to see what you're actually passing on.
$url_params{foo} = $db_row->{whatever}; I used to think making everything very dynamic was a good idea. I don't anymore. There's a bunch of cases where being specific can make the code easier to read and less exposed to bugs. On Friday, July 22, 2016 at 3:12:52 AM UTC+2, Randall Sindlinger wrote: > > Hi, > > I'd like to take a given named route, and ask what the placeholders are > that it expects. > > I'm trying to do a relatively simple call of > $c->url_for( $route_name, \%url_params ); > > However, the keys for %url_params are coming out of database tables, and > I've run into a case where the logic is breaking down when I create the > key. (it's trying to append '_identifier' to the column name when it > shouldn't). > > I'd like to be able to check if the key name that is created matches the > placeholder name used by the route before calling out to url_for. > > It looks like if I do > $foo=$c->app->routes->find($route_name) > that then I can see the placeholder underneath > $foo->pattern->tree > > But I feel like I'm diving too deep into it. Is there a better way? > > Thanks in advance for any thoughts, > -Randall > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to mojolicious@googlegroups.com. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.