Re: [Clip] Re: Problems capturing STDERROR
- On 4/3/2001 at 7:26 AM wheeler54321@... wrote:
>You see - I have all these problems without the quotes around "^**".None of this still works. You see, ^$GetOutput()$ gives no problem when trying to get the output of a Perl script. *THAT* I can do fine... absolutely no problem...
>I think ^$GetOutput$/^$GetDosOutput work best (if not ONLY) with ^!
>TextToFile or ^!Info or the output will get placed in the ^** doc.
^!Prompt ^$GetOutput("perl ^**")$ works everytime.
It is only when trying to catch the output of a Perl syntax check ("perl -c ^**") that the problem occurs. Syntax Check does not output to StdOut - it outputs to StdErr. Since there is no ^$GetStdErr()$ function, I have to resort to running the command line and then opening StdError.Err to see what happened.
Most of the time, StdError.Err doesn't even get created, so when it comes time to open it (in ANY way, whether OPEN or ^!Info or whatever) there is nothing to open.
The rest of the time, I get, in StdError.Err the message - Can't open perl script "E:\perlstuff\address2.pl": Invalid argument. You are talking about the quotes here. They don't matter. Try at a command line 'perl -c perlscript' or 'perl -c "perlscript"' you will find you get the same result. Perl handles it both ways.
I've tried this SO many ways, that I am convinced that there is just a bug somewhere in this.
- At 10:20 PM 4/4/01, Jason Waugh wrote:
> >I don't know the intricacies of using ^** you might have a point about it'sThanks for the memory jog!
> >'inconsistency' You would think it would work the same as ^$GetDocName$.
> >Actually I never bother using "^**" and always use ^$GetDocName$
>Well, it's not so much an inconsistency with ^** as it is an inconsistency
>in the way NoteTab and Perl are working together with respect to
>STDERR. Maybe Perl isn't flushing before NoteTab thinks it's done
>capturing STDERR? Maybe the NoteTab parser occasionally chokes on parsing
>^**? This would result in the two different error messages appearing on
>different tries with the same script....
I experienced the buffering problem when porting PERL scripts from Unix to
MS-DOS several years ago (Perl 4, so the details have changed about
avoiding the problem since I wrote those scripts). I recall needing to
either disable buffering, or set it to line buffering (from block
buffering) to make the problem go away.
Find a Perl reference (here's one I have: "Programming Perl", second
edition, by Larry Wall, Tom Christiansen & Randal L. Schwartz, published by
O'Reilly, copyright 1996) and look for information on the "$|"
variable. It allows you to set output filehandles to block buffering
(default) or line buffering (which is needed for Perl with NoteTab, since
it runs as a DOS program).
Hope this is helpful.