in reply to Multiple routes that execute the same action
People using Moose sometimes forget that Moose is still Perl. They need to do something unusual; something outside the bounds of what Moose has sugar for, and they forget that they've still got the rest of Perl at their disposal, and what they want to do is actually pretty easy.
Now it seems that Dancer has the same problem. What you want is to do is actually pretty easy. Don't forget you have all of Perl at your disposal, including, (shock!) variables that you can, like, assign stuff to, and then, like, re-use in multiple places...
{ my $code = sub { ... }; my @paths = qw( /myaction1/:param1 /myaction2/:param2 ); get($_, $code) for @paths; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiple routes that execute the same action
by McA (Priest) on Mar 28, 2014 at 12:40 UTC | |
|
Re^2: Multiple routes that execute the same action
by perl_help26 (Beadle) on Mar 28, 2014 at 13:19 UTC |