Zaphod::Editor::Action - encapsulate a change in the editor



Lists all the verbs that this package exports. Every verb should be a constructor that returns an instance of this class which performs and undoes the action.

No constructor should modify the document. The editor will call the apply method on the action to change the document.

$action->apply EDITOR

$action->revert EDITOR


Returns a (semi-shallow) copy of the action

Copied entities are:

  * offset
  * text_before
  * text_after


Returns the action as a Javascript serialized string. Currently this doesn't handle escaping properly - the strings are simply passed through quotemeta, which might run afoul of newlines or HTML chars.

The cursor status of the action is not carried over, as this is uninteresting.


A convenience method that returns the three vital elements of the action. Equivalent to the following code:

    local $_ = $action;


Decodes a list of actions from a string


Mapping of quoted chars to their unquoted internal representation.

Currently maps:

  \r \t \n \" \' \0 \\

unquote ELEMS

Unquotes a string according to %unquote. Modifies its arguments in-place.

decode STR

Decodes all actions from STR. If an action is syntactically invalid it is skipped.


Written by Max Maischein <>

Copyright Max Maischein 2005,2006; All Rights Reserved.

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