NAME
Term::CallEditor - solicit for data from an external Editor
SYNOPSIS
use Term::CallEditor;
my $fh = solicit('FOO: please replace this text');
die "$Term::CallEditor::errstr\n" unless $fh;
print while <$fh>;
DESCRIPTION
This module calls an external editor with an optional text message and returns what was input as a file handle. By default, the EDITOR environment variable will be used, otherwise vi
.
The solicit()
function currently can parse a message from a number of formats, including a scalar, scalar reference, array, or objects with the getlines
method such as IO::Handle or IO::All.
On error, solicit()
returns undef
. Consult $Term::CallEditor::errstr
for details.
EXAMPLES
- Pass in a block of text to the editor.
-
my $fh = solicit(<< "BLARB"); FOO: This is an example designed to span multiple lines for the sake FOO: of an example that span multiple lines. BLARB
- Support bbedit(1) on Mac OS X.
-
To use bbedit(1) as the EDITOR, create a shell script wrapper to call bbedit(1) as follows, then set the wrapper as the EDITOR environment variable.
#!/bin/sh exec bbedit -w "$@"
AUTHOR
Jeremy Mates, <jmates@sial.org>
COPYRIGHT AND LICENSE
Copyright 2004 by Jeremy Mates
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
HISTORY
Version control systems like CVS and Subversion have similar behaviour to prompt a user for a commit message, which this module is inspired from.