perl-Catalyst-Plugin-SanitizeUrl / Catalyst-Plugin-SanitizeUrl / lib / Catalyst / Plugin /

package Catalyst::Plugin::SanitizeUrl;

use strict;
use warnings;

our $VERSION = '0.2.1';

use base 'Catalyst::Plugin::SanitizeUrl::PrepAction';

sub get_action_path
    my $c    = shift;
    my $path = $c->req->path;
    return [ split /\//, $c->req->path, (-1) ];



=head1 NAME

Catalyst::Plugin::SanitizeUrl - Make Catalyst not ignore trailing slashes


    use Catalyst 'SanitizeUrl';


This plugin makes sure Catalyst is not agnostic to trailing slashes in the 
URLs passed to it by the user agent.

By default Catalyst will treat the following URLs:




As the same, even though user agents treat them differently as far as relative
URLs are concerned.

This plugin will cause the trailing slashes to be included in the Catalyst


=head2 prepare

Sets up $c->{form}

=head2 get_action_path

Overrided from L<Catalyst::Plugin::SanitizeUrl::PrepAction> to do 
the right thing.

=head1 NOTES

This module's name is misleading and problematic. I heard of a better module
to achieve the same ends as this module, but lost the reference.

=head1 SEE ALSO


=head1 AUTHOR

Shlomi Fish, C<>


This program is free software, you can redistribute it and/or modify it under
the terms of the MIT X11 license.

(Just note that the ::PrepAction module is derived from the Catalyst code 
itself and so is distributed under the same terms as Perl itself).

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.