NAME

Term::CallEditor - solicit data from an external editor

SYNOPSIS

use Term::CallEditor qw(solicit);

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, then returns any data from this editor as a file handle. By default, the EDITOR environment variable will be used, otherwise vi.

The solicit() function supports different input formats, including a scalar, scalar reference, array, or objects with the getlines method (IO::Handle or IO::All, for example).

On error, solicit() returns undef. Consult $Term::CallEditor::errstr for details.

EXAMPLES

Pass in a block of text to the editor.
my $fh = solicit(<< "END_BLARB");

FOO: This is an example designed to span multiple lines for the sake
FOO: of an example that span multiple lines.
END_BLARB
Support bbedit(1) on Mac OS X.

To use BBEdit as the external editor, create a shell script wrapper to call bbedit(1), then set this wrapper as the EDITOR environment variable.

#!/bin/sh
exec bbedit -w "$@"

AUTHOR

Jeremy Mates, <jmates@sial.org>

COPYRIGHT AND LICENSE

Copyright (c) 2004-2005, Jeremy Mates. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License:

http://www.perl.com/perl/misc/Artistic.html

HISTORY

Inspired from the CVS prompt-user-for-commit-message functionality.