|
NAMETerm::CallEditor - solicit data from an external editorSYNOPSISuse Term::CallEditor qw/solicit/; my $fh = solicit('FOO: please replace this text'); die "$Term::CallEditor::errstr\n" unless $fh; print while readline $fh; DESCRIPTIONThis module calls an external editor via the "solicit()" function, then returns any data from this editor as a file handle. The environment variables "VISUAL" and then "EDITOR" are consulted for a program name to run, otherwise falling back to vi(1). The Text::ParseWords "shellwords()" function is used to expand the environment variables."solicit()" returns a temporary file handle pointing to what was written in the editor (and also the filename in list context). FUNCTION
On error, "solicit()" returns "undef". Consult $Term::CallEditor::errstr for details. Note that File::Temp may throw a fatal error if the "safe_level" checks fail, so paranoid coders should wrap the "solicit" call in an "eval" block (or instead use something like Syntax::Keyword::Try). EXAMPLESSee also the "eg/solicit" script under the module distribution.
BUGSNo known bugs.Reporting BugsNewer versions of this module may be available from CPAN.If the bug is in the latest version, send a report to the author. Patches that fix problems or add new features are welcome. <https://github.com/thrig/Term-CallEditor> Known IssuesThis module relies heavily on the Unix terminal, permissions on the temporary directory (for the File::Temp module "safe_level" call), whether "system()" can actually run the "EDITOR" environment variable, and so forth.SEE ALSOvipe(1) of moreutils to use vi(1) in pipes.https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference "Most applications treat $VISUAL as a shell snippet that they append the (shell-quoted) file name to, but some treat it as the name of an executable which they may or may not search in $PATH. So it's best to set VISUAL (and EDITOR) to the full path to an executable (which could be a wrapper script if you want e.g. options)." -- Gilles AUTHORthrig - Jeremy Mates (cpan:JMATES) "<jmates at cpan.org>"COPYRIGHTCopyright 2004 Jeremy MatesThis program is distributed under the (Revised) BSD License: <https://opensource.org/licenses/BSD-3-Clause> HISTORYInspired from the CVS prompt-user-for-commit-message functionality.
Visit the GSP FreeBSD Man Page Interface. |