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

Re: [PBML] Re: how to redirect output

Expand Messages
  • Daniel Jones
    On Mon, 04 Dec 2000 13:06:43 -0000, ... You might want to post the line you re using to spawn the shell. You may having something wrong with your specific
    Message 1 of 8 , Dec 6, 2000
    • 0 Attachment
      On Mon, 04 Dec 2000 13:06:43 -0000,
      L.Hagen@... wrote:

      >> >This won't work for me, because i'm running the perl interpreter
      >from
      >> >a Visual Basic program (with the Shell command). Your suggestion
      >only
      >> >works when i run the script from the DOS-box. (I'm working on a NT
      >> >machine.) The solution i'm looking for should be independant from
      >the
      >> >DOS-box, so probably within the script itself.
      >>
      >> There still shouldn't be any reason you can't pass the
      >> redirection to the shell command. Simply add the ">
      >> mytextfile" to the command which spawns the shell.
      >No, it doesn't work...

      You might want to post the line you're using to spawn the
      shell. You may having something wrong with your specific
      syntax.

      >> If that won't work for some reason, how it the output within
      >> the script being created? Are you creating it, or is it an
      >> error message or similar from perl itself? If you're
      >> creating it via print statements or some such, you can
      >> simply print to a file. If it's automatically generated,
      >> you need to redirect stdout and/or stderr to the file. If
      >> you can't figure out how to do that from your docs, repost
      >> and I'll include an example.
      >
      >Actually it's both. I'm getting strings back from functions and print
      >them. But Perl also automatically creates messages that i want to
      >write to the file. How do i redirect these stout and/or stderr? It
      >would be very nice if you could provide me with such an example!

      STDOUT is where normal text is printed. It's usually the
      monitor screen, but doesn't necessarily have to be.

      STDERR is where error messages are printed. It's usually
      the same place as STDOUT but doesn't have to be.

      open (STDOUT, ">C:\\OUTFILE.LOG");
      open (STDERR, ">C:\\ERROR.LOG");
      print "This is a test.";
      #prints string to OUTFILE.LOG
      open (BAD_FILE, "NON_EXISTENT.FIL") or die "Can't open
      NON_EXISTENT.FIL";
      #prints error message to ERROR.LOG


      You can, of course, send normal output and error output to
      the same file if you wish.


      Regards,

      Dan
    Your message has been successfully submitted and would be delivered to recipients shortly.