Name

CatalystX::Usul::Plugin::Controller::PersistentState - Set/Get state information on/from the session store

Version

Describes v0.16.$Rev: 1 $

Synopsis

package YourApp::Controller::YourController;

use CatalystX::Usul::Moose;

extends q(CatalystX::Controller);
with    q(CatalystX::Usul::TraitFor::Controller::PersistentState);

Description

Uses the session store to provide uri arguments and parameters that are persistent across requests

Subroutines/Methods

get_uri_args

@args = $self->get_uri_args( $c );

Each action can define a list of named arguments in config. This method returns a list of values, one for each defined argument. Values are searched for in the following locations; the uri attribute cache, the request object, the session and finally the configuration default

get_uri_query_params

$params = $self->get_uri_query_params( $c );

Each action can define a list of key / value parameter pairs in config. This method return a hash ref of parameters. Values are searched for in the same locations as "get_uri_args"

init_uri_attrs

$self->init_uri_attrs( $c, $model_class );

This needs to be called early in chained controller methods. It initialises the attribute cache used by the other method calls

persist_state

When the role is applied $self-can( q(persist_state) )> is true

set_uri_args

$self->set_uri_args( $c, @args );

Saves the supplied list of arguments to the session and the cache

set_uri_attrs_or_redirect

$self->set_uri_attrs_or_redirect( $c, @args );

If at least one defined argument is passed then this method calls "set_uri_args" and "set_uri_query_params" and the returns. If no defined arguments are passed it calls "get_uri_args" and "get_uri_query_params". This method then creates a uri using these values and redirects to it

set_uri_query_params

$self->set_uri_query_params( $c, \%params );

Saves the supplied parameter hash to the session and the cache

Diagnostics

None

Configuration and Environment

None

Dependencies

Moose::Role

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2014 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE