NAME
Text::Edit - An easy way to startup a text editor
VERSION
Version 0.1
SYNOPSIS
my $content = "Hello There!";
Text::Edit::edit ($content, sub {
my ($newcontent, $has_changed) = @_;
if ($has_changed) {
print "the content was edited";
}
});
DESCRIPTION
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.
FUNCTIONS
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:
Text::Edit::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.
AUTHOR
Robin Redeker, <elmex at ta-sa.org>
TODO
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.
BUGS
Please report any bugs or feature requests to bug-text-edit at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-Edit. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Text::Edit
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2007 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.