NAME

Catalyst::Plugin::Reverse - Enhanced reverse URI construction

VERSION

Version 0.03

SYNOPSIS

# Plugin setup
use Catalyst qw(
   ...
   Reverse
   ...
));

# Plugin configuration
__PACKAGE__->config->{'Plugin::Reverse'}{'action'} = 1;
__PACKAGE__->config->{'Plugin::Reverse'}{'strict'} = 0;

# Per-action customization
sub index :Local :ReverseDisable {
    # here 'uri_for' works like generic
}
sub view :Local :ReverseStrict {
    # here 'uri_for' raise an exceptions
}

# Usage of 'reverse' method
sub list :Local :Args(0) {
    my ( $self,$c ) = @_;

    my $uri = $c->reverse('Catalog::Item::edit', [1], 2 );
}

CONFIGURATION

enabled

Enable plugin functionality entirely. Enabled by default.

strict

Raise Catalyst exception instead returning undefined value during unsuccessful URI construction. Enabled by default.

relative

Strip prefix from stringified uri_for result. Enabled dy default.

stringify

Force stringification of URI object from uri_for method. Implicitly enabled by relative setting.

prefix

Part to strip from begin of uri_for result while relative enabled. Default is stringified result of $c->uri_for(base).

base

Relative URI to determine prefix. Default is "/".

action

Enable per-action attributes processing. Enabled by default.

ACTION ATTRIBUTES

with action setting enabled you can locally override global plugin settings with special action attributes:

ReverseDisable / ReverseEnable

Locally override enabled setting.

ReverseStrict / ReverseNoStrict

Locally override strict setting.

ReverseStringify / ReverseNoStringify

Locally override stringify setting.

ReverseRelative / ReverseNoRelative

Locally override relative setting.

METHODS

reverse ( $name, \@captures?, @args?, \%query_values? )

URI reverse engineering without guessing.

$name

Controller (optionally) & method spearated by "::". If no controller specified current controller assumed as default. Valid specifications:

'Foo::Bar::view'

Method 'view' in 'App::Controller::Foo::Bar'.

'index'

Method 'index' in current controller.

\@captures?, @args?, \%query_values?

Passed unchanged to uri_for_action method.

uri_for

Wrapped uri_for method with optionally strictness, strigificating and absolute prefix stripping.

AUTHOR

Oleg A. Mamontov, <oleg at mamontov.net>

BUGS

Please report any bugs or feature requests to bug-catalyst-plugin-reverse at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Plugin-Reverse. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Catalyst::Plugin::Reverse

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2011 Oleg A. Mamontov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.