AnyEvent::EditText - An easy way to startup a text editor


Version 0.2


   my $content = "Hello There!";

   AnyEvent::EditText::edit ($content, sub {
      my ($newcontent, $has_changed) = @_;

      if ($has_changed) {
         print "the content was edited";


This little module will start a text editor in a seperate process without stopping the current process. Usually something like a terminal with a vim instance running in it will be started, but also a graphical editor could be used (like gedit or gvim).

The editor will get the content passed to the edit routine as temporary file, and after you are done editing it (closed the editor) the callback will be called with the possibly new content.


set_editor (@sysargs)

This function configures the editor used. @sysargs is a list of arguments for the system function, which will be called like this by edit:

   system (@sysargs, $filename);

The default editor used will be:

   AnyEvent::EditText::set_editor ("rxvt", "-e", "vim");

edit ($content, $callback)

This routine will write $content to a temporary file, fork and call the editing process. After the process terminates the temporary file is read and erased.

After that the content is sent back to the calling process, where the $callback is called with two arguments: The first will be the new content and the second a flag indicating whether the content has changed.


Robin Redeker, <elmex at>


This module should probably first look in the environment to determine which editor and terminal to use. This will be fixed in the next release.


Please report any bugs or feature requests to bug-text-edit at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc AnyEvent::EditText

You can also look for information at:


Copyright 2007 Robin Redeker, all rights reserved. Copyright 2008 Robin Redeker, all rights reserved.

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