<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000;"><div>Hello all,<br><br>I am trying to use vi as a UI to edit/check dynamic created perl code segment. When user save and quite the vi, the script will check its syntax and force to open the file again if there are any compiling error. I'd like to have the error message show in the new opened vi interface but don't know how to do it. Is here any suggestion?<br><br>Thanks,<br><br>Below is the segment invoke vi and do the check?<br><br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">my $msg;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">do {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier
 New,courier,monaco,monospace,sans-serif;">  if (defined $msg) {</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">    warn "$msg";</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">    my $dummy = <STDIN>;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">  }</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">  system("/bin/vi",  $tmpfile) == 0 or die $!;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier
 New,courier,monaco,monospace,sans-serif;">  $msg = `/usr/bin/perl -c $tmpfile`;</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">} while  ($? != 0);</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br></div>



</div></body></html>