473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Reassign STDERR within script

I haven't used Perl in many years, and can't remember how to do this. If I invoke my script with 'fixhbm.pl 2>fixhbm.errlog', STDERR is redirected to a file and stays out of my console output.

How do I accomplish the same within the program?
Oct 8 '07 #1
2 2831
numberwhun
3,509 Expert Mod 2GB
I haven't used Perl in many years, and can't remember how to do this. If I invoke my script with 'fixhbm.pl 2>fixhbm.errlog', STDERR is redirected to a file and stays out of my console output.

How do I accomplish the same within the program?
You may want to read this to get an answer to your question.

Regards,

Jeff
Oct 8 '07 #2
Thanks Jeff. That's a terrific reference for an old, failing memory.

I also found elsewhere a reference to 'open' that led me to this:

open STDERR, '>', "fixhbm.errlog";

which does just what I need. Or if I don't want to capture the output (I know what it is in this case and don't need it), this works as well:

open STDERR, '>', "/dev/null";

Again, thanks for the help. My question is answered.
Oct 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: | last post by:
I want to write all produced error messages (error, warning, notify, etc...) to STDERR. Is this possible without writing my own error handling routine?
3
by: Moretti | last post by:
Hello, I would like to be able to change the standard error path. How can I do this in a script if I want to send error messages to /dev/null by example ? Thanks -- Sebastien Moretti
5
by: Wesley Henwood | last post by:
To capture output from python scripts run from a C++ app I've added the following code at the beggening of the C++ app: PyRun_SimpleString("import grabber"); PyRun_SimpleString("import sys");...
3
by: Fuzzyman | last post by:
Hello all, Before I ask the question a couple of notes : * This question is for implementing a script inside the Wing IDE. For some reason using the subprocess module doesn't work so I need a...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
1
by: reubendb | last post by:
Hello, I have some function that output too much stuff to stderr when called, and I have no control over the function itself. So I thought as a workaround, I redirect stderr to /dev/null before...
1
by: Erik Jones | last post by:
So, I was just taking a look at doctest.py and saw this: Then running the module as a script will cause the examples in the docstrings to get executed and verified: python M.py This won't...
4
by: lovecreatesbea... | last post by:
For example, in Bourne Shell both stdout and stderr can be re-directed to /dev/null, $ ./a.out 2>&1 /dev/null then is there any difference still?
10
by: Isaac Gouy | last post by:
$ ./test_fail 1 Floating point exception - but this leaves 'somefile' zero size $ ./test_fail 1>somefile Floating point exception
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.