in reply to Re: How to launch vim from Perl
in thread How to launch vim from Perl

`vim $some_file` is not correct. The backticks attempt to capture the stdout of the program, which in this includes the interface, so launching vim pointless, because the interface isn't displayed and therefor is unusable. In this case, you want to use: system "vim"; which will allow vim to display it's own STDOUT and read from STDIN.

As for reasoning, many nix type command line scripts need a fair amount of text input, so much that typing it all in to stdin, with the associated problems of editing, would be too much hassle. So you launch vim pointed at a temporary file, wait for them to type the necessary data, save it, and quit, then your program resumes and you read the file.

Replies are listed 'Best First'.
Re^3: How to launch vim from Perl
by thor (Priest) on Nov 30, 2004 at 13:45 UTC
    So you launch vim pointed at a temporary file
    I prefer to lauch $ENV{EDITOR}. Use vim if the user doesn't have this set, but if the user has gone to the trouble to set her editor to emacs, don't force vim down her throat.

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

Re^3: How to launch vim from Perl
by insaniac (Friar) on Nov 30, 2004 at 16:26 UTC
    ah, you're right :-)
    i was too impulsive in my reply, so i hadn't tested what i said... shame on me :'(
    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame