CatalystX::TraitFor::Dispatcher::ExactMatch - handle trailing slashes properly
package MyApp; use Catalyst::Runtime 5.80; use Catalyst qw/ -Debug Static::Simple /; use CatalystX::RoleApplicator; __PACKAGE__->apply_dispatcher_class_roles( qw/CatalystX::TraitFor::Dispatcher::ExactMatch/ );
The Catalyst dispatcher doesn't differentiate between:
Not even with Regex dispatching. Not even by writing a custom dispatch type.
This is apparently a "feature". As far as I'm concerned, it's a bug.
This trait for Catalyst::Dispatcher attempts to perform an exact match, including trailing slashes, ahead of Catalyst's default dispatching. It's not been tested in every possible configuration, but it works for me.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=CatalystX-TraitFor-Dispatcher-ExactMatch.
Catalyst::Plugin::SanitizeUrl appears to do something similar for pre-Moose versions of Catalyst.
Toby Inkster <firstname.lastname@example.org>.
This software is copyright (c) 2011, 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.