Hi all,
      I've written a PERL program that  runs other PERL programs (through 
'require' statements and what not).  It worked fine for a couple tasks I had in 
 mind, but there's an obstacle ahead in the next thing I want to use it  for.  
The programs it will execute may  (or may not) have syntax errors.  Asking  it 
to 'require' a program with a syntax error will cause the main program to quit  
and print out the appropriate error message for that.  I don't want that.  I 
want  it to keep going.
      Recently I've posted questions here  about compiling.  My thinking was 
that  if my main program were running machine language programs instead, I 
wouldn't  get those syntax errors.  (The programs  might still be junk, and 
might give peculiar results, but that's ok.)  I haven't figured that out yet, 
but I  haven’t given up on it either.
      However my uncle  suggested another  possibility, avoiding any need to 
compile; that I check for syntax  errors first - in which case I can simply go 
on to the next program,  thereby avoiding a  shutdown of the main program.  
This  sounded nice but seemed hopeless in practicality (there are so many 
possible  syntax errors).  But then it occurred to  me that PERL already checks 
for syntax errors.   It recognizes them of course, but there's also the -c 
option.  I thought I could put a line in the main  program like
      system('perl -c  nextprogramtoexecute.pl');
      and check to see if that gives me a  syntax OK message or not.  But I 
can't  figure out how to get a hold of the message.   I figured it would be in 
STDOUT, but I can't figure out how to make use of  that.  I have a PERL 
textbook in front  of me, but it says precious little about STDOUT.   I've 
tried capturing this in a variable with backticks, qx//, and the  open function 
with a vertical bar.  All  of those shut down my computer, saying I performed 
an illegal operation.  (Which in itself is another problem.  I mean it's one 
thing to just not work...)
      So, many thanks in advance to  anyone who can tell me how to use STDOUT 
for this.  Or if you have another way to read that message before the program  
quits, or another way to test for syntax errors... that's cool too.  But I 
suspect STDOUT is going to be the best  thing.
      Fred Kittelmann
      P.S. I'm not using UNIX, if that  matters.
      
                
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.

Reply via email to