Loading ...
Sorry, an error occurred while loading the content.

RE: [Clip] Re: Problems capturing STDERROR

Expand Messages
  • Grant
    ... Ok try this example, For scripting in a win2k enviro I use ^$GetOutput()$ and pass the script file to the script interpreter on the commandline.
    Message 1 of 31 , Apr 2, 2001
    • 0 Attachment
      > >^$GetDosOutput("perl -c ^**")$
      > >^!Info ^$GetFileText("^$GetAppPath$StdError.err")$
      > >
      > >I know this work on Win98 SE, I just can't get it to work on WinMe.

      > Hmmn. I am trying to do this on Win2000. (With NTPro 4.85)

      Ok try this example,
      For scripting in a win2k enviro I use ^$GetOutput()$ and pass the script
      file to the script interpreter on the commandline.

      H="perlHelloLoginExample"
      ^!Set %PlFile%=^$getScriptPath()$hello.pl
      ^!Toolbar new document
      use Win32;
      print "hello\n";
      ^!Save as ^%PlFile%
      ^!INFO ^$GetOutput(perl "^%PlFile%")$
      ;Add more stuff
      ^%nl%print Win32::LoginName()
      ^!save
      ;Run perl file by using docName ^$GetDocName$
      ^!INFO ^$GetOutput(perl "^$GetDocName$")$

      ;You might also want to try running perlScript in the windows script host.

      H="perlScripInHost"
      ^!Set %PlFile%=^$getScriptPath()$testingWSH.wsf
      ^!Toolbar new document
      <?XML version="1.0"?>
      <job id="hello">
      <script language="PerlScript">
      <![CDATA[
      use Win32;
      $WScript->Echo('Hi');
      $WScript->Echo(Win32::LoginName());
      $WScript->Echo(Win32::NodeName());
      ]]>
      </script>
      </job>
      ^!Save as ^%PlFile%
      ^!INFO ^$GetOutput(Cscript "^%PlFile%")$
    • Phillip S. Buckland, Jr.
      ... Thanks for the memory jog! I experienced the buffering problem when porting PERL scripts from Unix to MS-DOS several years ago (Perl 4, so the details have
      Message 31 of 31 , Apr 5, 2001
      • 0 Attachment
        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's
        > >'inconsistency' You would think it would work the same as ^$GetDocName$.
        > >Actually I never bother using "^**" and always use ^$GetDocName$
        > >instead.
        >
        >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....

        Thanks for the memory jog!

        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.
      Your message has been successfully submitted and would be delivered to recipients shortly.