[Chicago-talk] Use vi in perl

tiger peng tigerpeng2001 at yahoo.com
Tue May 24 13:49:15 PDT 2011


Hello all,

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?

Thanks,

Below is the segment invoke vi and do the check?

my $msg;
do {
  if (defined $msg) {
    warn "$msg";
    my $dummy = <STDIN>;
  }
  system("/bin/vi",  $tmpfile) == 0 or die $!;
  $msg = `/usr/bin/perl -c $tmpfile`;
} while  ($? != 0);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20110524/2e6441a9/attachment.html>


More information about the Chicago-talk mailing list