why do you need vim for stdin and stdout? just use:
$a = <STDIN>; # This is one way of how you read user input
print $a, "\n"; # This is one way of printing to stdout
or if you want achieve something like this cat some_file | some_perlscript.pl, then you could write something like this in your script:
while(my $line = <>) { # reads from stdin
print $line; # prints everything to stdout
}
but if you really want to start vim from a perl script, just use the backticks:
`vim $some_file`;
maybe if you gave us some more specs, we'd understand you better ;-)
--
to ask a question is a moment of shame
to remain ignorant is a lifelong shame
| [reply] [d/l] [select] |
`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.
| [reply] [d/l] [select] |
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
| [reply] |
| [reply] |
| [reply] |