Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Redirecting output

Reply
Thread Tools

Redirecting output

 
 
kvrnkiran@gmail.com
Guest
Posts: n/a
 
      07-07-2005
Hi Everybody,

I am a new-bee in PERL. Basically, I am a VC++ programmer. I am in the
process of running PERL script from my VC++ code. I have completed this
task succcessfully. Now, I am facing a problem. As I am running my perl
script from my executable, I am unable to get any of the messages
displayed by perl compiler, like compiler errors, print outputs etc. To
be specific, any messages to stdout and stderr.

Is there a way to capture those messages? Can anybody help me?

Thanks for your time.

KVRN Kiran Kumar.

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      07-07-2005
wrote:
> Hi Everybody,
>
> I am a new-bee in PERL.


Then you would do well to read some of the FAQs with come with Perl.
Starting with
perldoc -q difference
"What is the difference between 'Perl' and 'perl'?"

> Basically, I am a VC++ programmer. I am in the
> process of running PERL script from my VC++ code. I have completed this
> task succcessfully. Now, I am facing a problem. As I am running my perl
> script from my executable, I am unable to get any of the messages
> displayed by perl compiler, like compiler errors, print outputs etc. To
> be specific, any messages to stdout and stderr.
>
> Is there a way to capture those messages? Can anybody help me?


If I understand correctly what you're asking, I don't believe this
question has anything to do with Perl. It has to do with whatever
language the parent program is written in, which you say is C++. You
can tell it has nothing to do with Perl because the question would be
the same no matter what language the child program is written in.

What you need to do is figure out how to capture STDOUT and STDERR by
whatever method your C++ executable is calling a child process. For
that, I would suggest asking one of the C++ newsgroups, instead of the
Perl newsgroup.

If, on the other hand, you are attempting to redirect the Perl
program's STDOUT and STDERR from within the Perl program itself, you
can do it like so:

open STDOUT, '>>', 'outfile.txt' or die "Can't redirect STDOUT: $!";
open STDERR, '>>', 'errfile.txt' or die "Can't redirect STDERR: $!";

>From that point on, all prints and warnings that the Perl script (but

not the perl interpreter that runs your Perl script!) generates will be
directed to the files outfile.txt and errfile.txt, respectivly.

Paul Lalli

 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      07-10-2005
wrote:
> I am unable to get any of the messages
> displayed by perl compiler, like compiler errors, print outputs etc. To
> be specific, any messages to stdout and stderr.


Have you tried the obvious?

Start->Run->cmd
C:\>perl myprogram.pl

The first step creates a window in which STDOUT and STDERR can be
displayed. Is that what you want?

Otherwise you'll need to check the VC++ documentation on how
to invoke an external program in such a way that the program's
STDERR and STDOUT are readable from VC++.
-Joe
 
Reply With Quote
 
kvrnkiran@gmail.com
Guest
Posts: n/a
 
      07-12-2005
Dear Paul,

Thank you for your reply. I think, you are correct. It might not be
related to PERL. I will look into VC++ end to resolve this issue.

Thank you once again for your time.

Regards,
KVRN Kiran Kumar.

 
Reply With Quote
 
Paul Lalli
Guest
Posts: n/a
 
      07-12-2005
wrote:
> Dear Paul,
>
> Thank you for your reply. I think, you are correct. It might not be
> related to PERL. I will look into VC++ end to resolve this issue.
>
> Thank you once again for your time.


The best way of thanking me would be to first read the Posting
Guidelines for this group (which would have instructed you to quote an
appropriate amount of context in your reply) and to second read the
Perl FAQ I asked you to read in my initial reply (which would have
educated you as to why "PERL" is never a correct way of spelling
"Perl").

Paul Lalli

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirecting unittest output to a Text widget MrBlueSky Python 2 05-10-2006 08:22 AM
Redirecting print output to different queues / printers Paul Aspinall ASP .Net 0 02-26-2006 12:02 PM
RE: Redirecting system output quietly Eddie Parker Python 4 11-16-2004 06:01 PM
Textfield output redirecting Olivier Merigon Java 1 05-18-2004 09:15 PM
stdout funniness from os.system() calls when redirecting output Birch Python 3 10-21-2003 04:16 PM



Advertisments