NAME

Krang::CGI::SessionEditor - Krang base class for CGI modules that edit objects in the session


SYNOPSIS

    package Krang::CGI::Template;
    use Krang::ClassLoader base => 'CGI::SessionEditor';
    use Krang::ClassFactory qw(pkg);
    sub edit_object_package { pkg('Template') }
    my $obj = $self->get_edit_object();
    $self->set_edit_object($obj);
    $self->clear_edit_object();


DESCRIPTION

Krang::CGI is a subclass of CGI::Application. All the usual CGI::Application features are available.


INTERFACE

REQUIRED METHODS

edit_object_package

This method returns the name of the package that is used to pull the object from the database. This package must have a Krang compatible find() and id_meth() method.

METHODS

This is a subclass of Krang::CGI so it inherits all of those methods and provides the following additional methods:

get_edit_object

This method will get the object in question from either the session or the database, depending on whether or not it exists. The following named parameters can alter the default behavior:

set_edit_object

clear_edit_object

edit_object_id

Get the id of the object being editted. This is useful when you just need the id but don't want to create a full blown object just to get it.

edit_uuid

Get or set the UUID for the current edit. This is how we track which object we are currently editting. Each incoming request that needs to edit the object must pass the edit_uuid value in the query string.

OVERRIDES

In addition to the methods above we override the following methods:

load_tmpl

We overload load_tmpl() so that edit_uuid is always set if it exists in the template.