Zaphod::Editor::Action - encapsulate a change in the editor
verbsLists 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$action->copyReturns a (semi-shallow) copy of the action
Copied entities are:
* offset * text_before * text_after
$action->as_js_stringReturns 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.
$action->argsA convenience method that returns the three vital elements of the action. Equivalent to the following code:
local $_ = $action;
return
$_->offset,
$_->text_before,
$_->text_after
;
Zaphod::Editor::Action->from_stringDecodes a list of actions from a string
%unquoteMapping of quoted chars to their unquoted internal representation.
Currently maps:
\r \t \n \" \' \0 \\
unquote ELEMSUnquotes a string according to %unquote. Modifies its arguments in-place.
decode STRDecodes all actions from STR. If an action is syntactically invalid it is skipped.
Written by Max Maischein <corion@cpan.org>
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.