NAME

Para::Frame::Change - DB Change class

DESCRIPTION

This is an object for collecting information about changes.

The idea is to let various methods add messages about changes or errors to objects. If everything is okey, display all the messages. If one of the messages returns an error, only display the error and do a rollback so that no changes is done to the DB.

Could be used in combination with methods in Para::Frame::DBIx.

METHODS

new

reset

  $changes->reset()

Resets the change object. Like creating a new object, but keeps the existing one.

Returns the now empty object.

rollback

  $changes->rollback()

success

  $changes->success( $message )

Adds a success message. Increments the changes counter.

Returns true.

note

  $changes->note( $message )

Adds a note, not counting as success or failure.

Returns true.

fail

  $changes->fail( $message )

Adds a failure message. Increments the errors counter.

Returns false.

changes

  $changes->changes

Returns the number of successful changes.

errors

  $changes->errors

Returns the number of errors

message

  $changes->message

Returns the messages from the successful changes. Each message separated by a newline.

errmsg

  $changes->errmsg

Returns teh error messages. Each message separated by a newline.

queue_clear_params

  $changes->queue_clear_params( @list )

Will call <Para::Frame::Utils/clear_params> before rendering the resulting page, unless we got a rollback.

before_render_output

Called just before $req->response->render_output

report

  $changes->report

  $changes->report( $errtype )

Puts the /message in a Para::Frame::Result/message.

If there is an /errmsg, Throws an exception with that message of type $errtype. The default errtype is validation.

SEE ALSO

Para::Frame