Re: Perl file and STDERR

2013-07-10 Thread Kenneth Wolcott
780596001735.do >> >> ) >> 10.18. Autoflushing >> >> Avoid a raw select when setting autoflushes . > > Very nice and important info but I/O buffering has been optimized. Do > not enable autoflush. Things go slower if you do. When I need to save the merged

Re: Perl file and STDERR

2013-07-10 Thread Shawn H Corey
On Wed, 10 Jul 2013 10:49:37 -0500 Andy Bach wrote: > On Wed, Jul 10, 2013 at 7:08 AM, Shawn H Corey > wrote: > > > Auto-flush is a de-optimization. Don't set it. > > > > More "Best Practices" on autoflush (note, the original book "Perl Best > Practices" by Damian Conway is well worth the p

Re: Perl file and STDERR

2013-07-10 Thread Andy Bach
On Wed, Jul 10, 2013 at 7:08 AM, Shawn H Corey wrote: > Auto-flush is a de-optimization. Don't set it. More "Best Practices" on autoflush (note, the original book "Perl Best Practices" by Damian Conway is well worth the price. Even for those few you may not agree with, practices-wise, you'll le

Re: Perl file and STDERR

2013-07-10 Thread Shawn H Corey
On Wed, 10 Jul 2013 04:57:44 -0400 shawn wilson wrote: > On Jul 10, 2013 2:01 AM, "jitendra B" wrote: > > > > Thank you very much Andy, Nathan, Shawn for your kind help. > > > > I am new to the perl. Why auto-flush is needed here (STDERR > > autoflush

Re: Perl file and STDERR

2013-07-10 Thread shawn wilson
On Jul 10, 2013 2:01 AM, "jitendra B" wrote: > > Thank you very much Andy, Nathan, Shawn for your kind help. > > I am new to the perl. Why auto-flush is needed here (STDERR autoflushes)? > Probably for consistency with autoflush being enabled for STDOUT, it'

Re: Perl file and STDERR

2013-07-09 Thread jitendra B
Thank you very much Andy, Nathan, Shawn for your kind help. I am new to the perl. Why auto-flush is needed here (STDERR autoflushes)? It will free the memory or something else. Regards, Jitendra On Tue, Jul 9, 2013 at 9:10 PM, Andy Bach wrote: > > On Tue, Jul 9, 2013 at 9:37 AM,

Re: Perl file and STDERR

2013-07-09 Thread Andy Bach
On Tue, Jul 9, 2013 at 9:37 AM, Nathan Hilterbrand wrote: > I want to open a file read+write mode and change > > the > > some content in same file without creating another file and copy to it. > You might want to look at the perl "in place mode" [1], so something like perl -i.bak -pe ' s/BLR/ban

Re: Perl file and STDERR

2013-07-09 Thread Nathan Hilterbrand
See below > Hi All, > > > Can you please let me know the following snippset? why it is used for? > > > select( STDERR ); > $| = 1; > select( STDOUT ); > $| = 1; > print STDERR "\nThis is india\n\n"; > print STDERR "Usage: This is build&

Re: Perl file and STDERR

2013-07-09 Thread Shawn H Corey
On Tue, 9 Jul 2013 13:24:54 +0530 jitendra B wrote: > Can you please let me know the following snippset? why it is used for? > > > select( STDERR ); Change the default file handle use by `print` and `say` to STDERR. The default file handle is use when no file handle is specif

Re: Perl file and STDERR

2013-07-09 Thread John W. Krahn
jitendra B wrote: Hi All, Hello, Can you please let me know the following snippset? why it is used for? select( STDERR ); Select STDERR as the default filehandle. $| = 1; Turn on autoflush for the current default filehandle. (Redundant because STDERR autoflushes by default

Perl file and STDERR

2013-07-09 Thread jitendra B
Hi All, Can you please let me know the following snippset? why it is used for? select( STDERR ); $| = 1; select( STDOUT ); $| = 1; print STDERR "\nThis is india\n\n"; print STDERR "Usage: This is build"; print STDERR "where: base PL label\n"; and second que

Re: redirect STDERR

2010-11-04 Thread Bryan Harris
Thank you! > On Nov 2, 5:06 pm, bryan_r_har...@raytheon.com (Bryan R Harris) wrote: >> I have these lines in my script: >> >> ** >> for my $handle (*STDIN, *STDERR) { >>     open($handle, "+> /dev/null: $!.  Exitin

Re: redirect STDERR

2010-11-02 Thread C.DeRykus
On Nov 2, 5:06 pm, bryan_r_har...@raytheon.com (Bryan R Harris) wrote: > I have these lines in my script: > > ** > for my $handle (*STDIN, *STDERR) { >     open($handle, "+ /dev/null: $!.  Exiting.\n"; > > } > > # open outfil

redirect STDERR

2010-11-02 Thread Bryan R Harris
I have these lines in my script: ** for my $handle (*STDIN, *STDERR) { open($handle, "+$outfile") or die "$me: Couldn't open $outfile: $!\n"; $| = 1; # and don't buffer it ****** I

Re: Redirecting STDOUT and STDERR for system()

2009-07-06 Thread Eric Veith
That works like a charm -- thanks! "Chas. Owens" wrote on 07/05/2009 03:57:34 AM: > From: > > "Chas. Owens" > > To: > > Eric Veith/Germany/i...@ibmde > > Cc: > > beginners@perl.org > > Date: > > 07/05/2009 03:58 AM > > Subj

Re: Redirecting STDOUT and STDERR for system()

2009-07-04 Thread Chas. Owens
On Thu, Jul 2, 2009 at 04:36, Eric Veith wrote: > > Hello List, > > as part of a Perl script of mine, I want to execute a program, get its > return code AND capture its output on both STDERR and STDOUT. I tried > IO::Handle, but that only gives me STDOUT and not the return cod

Redirecting STDOUT and STDERR for system()

2009-07-02 Thread Eric Veith
Hello List, as part of a Perl script of mine, I want to execute a program, get its return code AND capture its output on both STDERR and STDOUT. I tried IO::Handle, but that only gives me STDOUT and not the return code. Using qr//, I cannot read linewise and have to load the complete program&#

Antw: How to print errors to both STDERR & a file?

2009-06-25 Thread Stephane Schmuck
Hello ! here my hint : #!/usr/bin/perl use strict; use warnings; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init( { file => ">> my_error_log", level => $ERROR, }, { file => "STDERR", level => $ERROR, } ); For more informations see ht

Re: redirecting STDERR with IO::Tee

2009-06-25 Thread Jenda Krynicky
Date sent: Mon, 22 Jun 2009 10:53:06 -0700 From: pa...@compugenic.com To: beginners@perl.org Subject:redirecting STDERR with IO::Tee > I have a script which runs mostly via a cron job and sometimes > interactively. I woul

Re: How to print errors to both STDERR & a file?

2009-06-25 Thread rkb
console) and a log file. What is the proper way of doing >> this? >> >> print STDERR mess; >> print FILEHANDLE mess; >> > > STDERR is where errors go. Error messages are generated as a result of > an error, not a 'print' statement. Athough I could

Re: How to print errors to both STDERR & a file?

2009-06-24 Thread Raymond Wan
Hi Pablo, pa...@compugenic.com wrote: STDERR is where errors go. Error messages are generated as a result of an error, not a 'print' statement. Athough I could manually print to STDERR, I'm trying to log all errors to both a logfile and STDERR. Hm, not quite sur

Re: How to print errors to both STDERR & a file?

2009-06-24 Thread pablo
proper way of doing this? > > print STDERR mess; > print FILEHANDLE mess; > STDERR is where errors go. Error messages are generated as a result of an error, not a 'print' statement. Athough I could manually print to STDERR, I'm trying to log all errors to both a logfile and

Re: How to print errors to both STDERR & a file?

2009-06-24 Thread Roman Makurin
On Wed, Jun 24, 2009 at 09:25:05AM -0700, pa...@compugenic.com wrote: > I'd like to automatically have my script's errors and warnings sent to > both STDOUT (console) and a log file. What is the proper way of doing this? print STDERR mess; print FILEHANDLE mess; > &g

Re: redirecting STDERR with IO::Tee

2009-06-24 Thread pablo
On Wed, Jun 24, 2009 at 05:52:36PM +0800, Jeff Pang wrote: > 2009/6/23 : > > I have a script which runs mostly via a cron job and sometimes > > interactively.  I would like STDERR to automatically print to both the > > console and to a logfile simultaneously. >

How to print errors to both STDERR & a file?

2009-06-24 Thread pablo
I'd like to automatically have my script's errors and warnings sent to both STDOUT (console) and a log file. What is the proper way of doing this? Pablo -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: redirecting STDERR with IO::Tee

2009-06-24 Thread Jeff Pang
2009/6/23 : > I have a script which runs mostly via a cron job and sometimes interactively. >  I would like STDERR to automatically print to both the console and to a > logfile simultaneously. > > Right now I've gotten as far as merging both file handles with IO::Tee but &

redirecting STDERR with IO::Tee

2009-06-22 Thread pablo
I have a script which runs mostly via a cron job and sometimes interactively. I would like STDERR to automatically print to both the console and to a logfile simultaneously. Right now I've gotten as far as merging both file handles with IO::Tee but I'm not sure if I'm heading

Re: How to catch error message instead of printing to stderr for rmtree

2008-09-25 Thread Yue Chen
t to use rmtree to delete a dir and use variables to catch the >> error message. However, when i am about to delete a dir that does not >> belong to me, it still print the error message to stderr. Does anyone >> have clue? >> >> my script: test.pl >> >> use

Re: How to catch error message instead of printing to stderr for rmtree

2008-09-25 Thread Li, Jialin
On Fri, Sep 26, 2008 at 12:17 AM, Yue Chen <[EMAIL PROTECTED]> wrote: > Hi > > I want to use rmtree to delete a dir and use variables to catch the > error message. However, when i am about to delete a dir that does not > belong to me, it still print the error message to stder

How to catch error message instead of printing to stderr for rmtree

2008-09-25 Thread Yue Chen
Hi I want to use rmtree to delete a dir and use variables to catch the error message. However, when i am about to delete a dir that does not belong to me, it still print the error message to stderr. Does anyone have clue? my script: test.pl use File::Path; File::Path::rmtree( '/root

threads and processes with redirected STDOUT and STDERR on win32

2008-08-25 Thread Alexandru Maximciuc
Hello beginners, any hints on this problem? win32... I have N threads. in each thread I want to run a command and redirect it's STDERR and STDOUT to a filehandle/socket opened in the main thread. I tried with IPC::Run3 but the outputs get scrambled. -- Best regards, Alex

Re: Can not mix output of STDERR and STDOUT

2008-07-17 Thread FixReader
On Jul 17, 9:24 pm, [EMAIL PROTECTED] (Yitzle) wrote: > On Wed, Jul 16, 2008 at 9:01 PM, <[EMAIL PROTECTED]> wrote: > > Hi experts > > When I am using STDERR and STDOUT for mixed output, I found a problem. > > Output of STDERR and STDOUT can not be mix

Re: Can not mix output of STDERR and STDOUT

2008-07-17 Thread yitzle
On Wed, Jul 16, 2008 at 9:01 PM, <[EMAIL PROTECTED]> wrote: > Hi experts > When I am using STDERR and STDOUT for mixed output, I found a problem. > Output of STDERR and STDOUT can not be mixed. > Here is the snippet. > > # > pri

Can not mix output of STDERR and STDOUT

2008-07-16 Thread FixReader
Hi experts When I am using STDERR and STDOUT for mixed output, I found a problem. Output of STDERR and STDOUT can not be mixed. Here is the snippet. # print STDOUT "This is STDOUT\n"; print STDERR "This is STDERR\n"; print STDO

Re: Logging STDERR and other output

2007-09-01 Thread Peter Scott
On Thu, 30 Aug 2007 10:57:20 -0300, Adriano Ferreira wrote: > On 8/30/07, Peter Scott <[EMAIL PROTECTED]> wrote: >> Why are you using a BEGIN block? Why not just make it the first >> executable statement? Do you have any other 'use' statements in the >> program? > > Because otherwise it would be

Re: Logging STDERR and other output

2007-09-01 Thread Peter Scott
On Thu, 30 Aug 2007 17:25:28 +0100, Beginner wrote: > On 30 Aug 2007 at 10:07, Mumia W. wrote: > >> On 08/30/2007 09:37 AM, Beginner wrote: >> > q2) Will our $logfile now be a shared variable across all my modules? >> Try it and see. > > No. It's not. Yes. It is. It was declared (three posts

Re: Logging STDERR and other output

2007-08-31 Thread Dr.Ruud
"Beginner" schreef: > Log::Handler looks pretty comprehensive. Consider also Log::Log4Perl. http://search.cpan.org/~mschilli/Log-Log4perl/lib/Log/Log4perl/FAQ.pm -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: Logging STDERR and other output

2007-08-31 Thread Dr.Ruud
"Beginner" schreef: > Adriano Ferreira: >> use lib qw(/etc/perl); > > use lib ('/etc/perl'); The idiom adivised by Adriano is more flexible. See `perldoc lib`. Example: use lib qw( /usr/local/cvs_tree/lib /etc/perl ); -- Affijn, Ruud "Gewoon is een tijger."

Re: Logging STDERR and other output

2007-08-30 Thread Beginner
ile and I can use a scalar for logfile. > > > > q1) Does this still give me the effect of getting any errors from the > > other modules directed to our $logfile? > > > > Probably not. There's no better way than to try it and see if it works. > Read "perldoc

Re: Logging STDERR and other output

2007-08-30 Thread Mumia W.
On 08/30/2007 09:37 AM, Beginner wrote: [...] I tried the INIT option and that worked also and I liked the fact that my `perl -c myscript.pl` sent it's output to screen and not my log file and I can use a scalar for logfile. q1) Does this still give me the effect of getting any errors from t

Re: Logging STDERR and other output

2007-08-30 Thread Beginner
; which doesn't need the surrounding "BEGIN" block. > > > $| = 1; > > open(STDERR, ">>/usr/local/myreports/report.log") || die > > "Can't write to file: $!\n"; > > } > > > > use MY::MakePDF; > >

Re: Logging STDERR and other output

2007-08-30 Thread Adriano Ferreira
On 8/30/07, Beginner <[EMAIL PROTECTED]> wrote: > On 30 Aug 2007 at 6:32, Peter Scott wrote: > > > On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > > > I want all the output plus any error messages to got to a log file. I > > > used the BEGIN

Re: Logging STDERR and other output

2007-08-30 Thread Adriano Ferreira
On 8/30/07, Peter Scott <[EMAIL PROTECTED]> wrote: > On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > > I want all the output plus any error messages to got to a log file. I > > used the BEGIN block to direct STDERR into the file: > > > > BEGIN { > >

Re: Logging STDERR and other output

2007-08-30 Thread Beginner
On 30 Aug 2007 at 6:32, Peter Scott wrote: > On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > > I want all the output plus any error messages to got to a log file. I > > used the BEGIN block to direct STDERR into the file: > > > > BEGIN { > > ope

Re: Logging STDERR and other output

2007-08-30 Thread Peter Scott
On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > I want all the output plus any error messages to got to a log file. I > used the BEGIN block to direct STDERR into the file: > > BEGIN { > open(STDERR, ">>/usr/local/myreports/report.log") || di

Re: Logging STDERR and other output

2007-08-30 Thread Mumia W.
On 08/30/2007 04:32 AM, Beginner wrote: Hi, I want all the output plus any error messages to got to a log file. I used the BEGIN block to direct STDERR into the file: BEGIN { open(STDERR, ">>/usr/local/myreports/report.log") || die "Can't write to file: $

Logging STDERR and other output

2007-08-30 Thread Beginner
Hi, I want all the output plus any error messages to got to a log file. I used the BEGIN block to direct STDERR into the file: BEGIN { open(STDERR, ">>/usr/local/myreports/report.log") || die "Can't write to file: $!\n"; } use strict; use warnings; ..

Re: Redirecting STDOUT & STDERR

2007-05-07 Thread John W. Krahn
Karyn Williams wrote: > I have this script I have been working on where I need to redirect STDOUT > and STDERR to files at the beginning of the script and then back to default > (terminal) at the end of the script. I found an example on-line and used it > and it works, however it

Re: Redirecting STDOUT & STDERR

2007-05-07 Thread Tom Phoenix
On 5/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote: I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it

Re: Redirecting STDOUT & STDERR

2007-05-07 Thread Adriano Ferreira
On 5/7/07, Karyn Williams <[EMAIL PROTECTED]> wrote: I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it

Redirecting STDOUT & STDERR

2007-05-07 Thread Karyn Williams
I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it works, however it generates a warning when running my script. I

Re: capture stdin and stderr

2007-03-20 Thread Mumia W.
On 03/20/2007 05:21 PM, Vladimir Lemberg wrote: Hi All, My script is calling a Win32 program with two arguments: system ( "$ARGV[0]\\program.exe", $File::Find::name, "$ARGV[0]\\source"); I want to capture STDOUT and STDERR from the program to log file

Re: capture stdin and stderr

2007-03-20 Thread Vladimir Lemberg
M Subject: RE: capture stdin and stderr -Original Message- From: Vladimir Lemberg [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 20, 2007 15:21 To: beginners@perl.org Subject: capture stdin and stderr Hi All, My script is calling a Win32 program with two arguments: system ( &quo

RE: capture stdin and stderr

2007-03-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Vladimir Lemberg [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 20, 2007 15:21 > To: beginners@perl.org > Subject: capture stdin and stderr > > Hi All, > > > > My script is calling a Win32 program with two arguments: >

capture stdin and stderr

2007-03-20 Thread Vladimir Lemberg
Hi All, My script is calling a Win32 program with two arguments: system ( "$ARGV[0]\\program.exe", $File::Find::name, "$ARGV[0]\\source"); I want to capture STDOUT and STDERR from the program to log file system ( "$ARGV[0]\\program.exe", $File::Find

Re: Capturing stdout and stderr without redirection

2007-01-19 Thread Peter Scott
On Thu, 18 Jan 2007 20:28:42 -0600, David Moreno Garza wrote: > On Thu, 2007-01-18 at 07:11 -0800, Peter Scott wrote: >> my $output = `myperlscript.pl 2>&1`; >> send_email($output) if $output; > > Isn't send_email($output) in this situation still going to happen? I > mean, even of there is not out

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread David Moreno Garza
On Thu, 2007-01-18 at 07:11 -0800, Peter Scott wrote: > my $output = `myperlscript.pl 2>&1`; > send_email($output) if $output; Doubt: Isn't send_email($output) in this situation still going to happen? I mean, even of there is not output on "myperlscript.pl 2>&1", $output is going to be set, meani

RE: Capturing stdout and stderr without redirection

2007-01-18 Thread Dan Fish
Igor, thanks for the tip! A search of CPAN turned up IPC::Open3::Simple Very cool... Very easy to use and exactly what I needed. Separate callback subs for STDOUT and STDERR... just push anything fed to them into an array... When all done, if array size > 0, fire off an email with the conte

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Peter Scott
. The sending in an email part I can handle. and I think > I can probably redirect the output of myperlscript.pl to a file and read > that, but is there a better, more elegant way to capture any stdout/stderr > output WITHOUT having to redirect and read another file? Look up backticks in pe

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Igor Sutton
nk I can probably redirect the output of myperlscript.pl to a file and read that, but is there a better, more elegant way to capture any stdout/stderr output WITHOUT having to redirect and read another file? Why don't you encapsulate the myperlscript.pl code on a reusable module, then ju

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Ken Foskey
part I can handle. and I think > I can probably redirect the output of myperlscript.pl to a file and read > that, but is there a better, more elegant way to capture any stdout/stderr > output WITHOUT having to redirect and read another file? Look up system2 in cpan. -- Ken Foskey FOSS

Capturing stdout and stderr without redirection

2007-01-17 Thread Dan Fish
ipt.pl to a file and read that, but is there a better, more elegant way to capture any stdout/stderr output WITHOUT having to redirect and read another file? Thanks! -Dan

Re: STDOUT and STDERR to same file

2006-08-29 Thread Jeff Pang
Hello, In your daemon script,you can re-direct the STDIN/STDOUT/STDERR to the null device like '/dev/null'. open (STDIN, "/dev/null"); open (STDERR,">&STDOUT"); Then you can redefine the 'warn' and 'die' handler to the subrouti

Re: STDOUT and STDERR to same file

2006-08-29 Thread Muttley Meen
On 8/29/06, Ken Foskey <[EMAIL PROTECTED]> wrote: I have a daemon process that works but I am currently running it with script.pl > error.log 2>&1 and I want to do the same thing without using the redirection,, remove the human error when starting the program. I c

Re: STDOUT and STDERR to same file

2006-08-29 Thread Mumia W.
On 08/29/2006 09:06 AM, Ken Foskey wrote: I have a daemon process that works but I am currently running it with script.pl > error.log 2>&1 and I want to do the same thing without using the redirection,, remove the human error when starting the program. I can `open( STDERR, '

Re: STDOUT and STDERR to same file

2006-08-29 Thread Tom Phoenix
On 8/29/06, Ken Foskey <[EMAIL PROTECTED]> wrote: I can `open( STDERR, '>', 'error.log') ...` but is there a piece of magic to duplicate that to STDOUT as well (ie same file output) open(STDERR, '>', 'error.log') or die "Can't r

STDOUT and STDERR to same file

2006-08-29 Thread Ken Foskey
I have a daemon process that works but I am currently running it with script.pl > error.log 2>&1 and I want to do the same thing without using the redirection,, remove the human error when starting the program. I can `open( STDERR, '>', 'error.log') ...`

Re: Redirecting STDERR

2005-10-07 Thread Stephen Kratzer
Opening the filehandle STDERR to a file will not persist beyond termination of the script, nor will it affect other programs running at the same time as the script. It affects only the running script. STDERR of the shell is different from that of perl. On Friday 07 October 2005 16:56, Timothy

Re: Redirecting STDERR

2005-10-07 Thread Jeff Pan
ROTECTED]>: > It partly depends on your operating system, I think. That's fine on > Windows, but on UNIX I think that under some if not all circumstances > your change will persist after the script finishes executing. I've > never had to do it, but I've seen one meth

RE: Redirecting STDERR

2005-10-07 Thread Timothy Johnson
open(OLD_STDERR,">&STDERR") or die "Failed to save STDERR"; open(STDERR,">script.err") or die "Failed to redirect STDERR"; do something... open(STDERR,">&OLD_STDERR") or die "Failed to restore STDERR"; -Original Message-

Redirecting STDERR

2005-10-07 Thread Ryan Frantz
Perlers, I have a script where I redirect STDERR to a file so that I can capture 'die' messages like so: use warnings; use strict; my $logfile = "/some/path/logfile.txt"; open STDERR, ">>$logfile"; something or die "Unable to do something()\n";

Redirecting STDERR and STDOUT ?

2005-05-13 Thread Michael Gale
Hello, I am using the following to redirect STDERR and STDOUT: open(STDOUT, "> $logfile") || die "Can't redirect stdout"; open(STDERR, ">&STDOUT") || die "Can't dup stdout"; select(STDERR); $| = 1; # make unbuffered select(ST

redirecting STDOUT/STDERR and File::Copy

2005-03-02 Thread Traeder, Philipp
Hi list, I've got some strange behaviour with redirected STDOUT/STDERR handles and calls to File::Copy - I hope someone can explain me why I'm seeing what I'm seeing here. I use the following code to redirect STDOUT and STDERR to a log file - as you can see, it's more or

Trapping stderr

2004-07-04 Thread sudhindra k s
  Hi I am writing a routine which gives me the right output, but lot of warning messages as well. This messages are related to the SCM tool i am using. I want to capture these warnings and supress them. i.e i dont want them to appear in the stdout. how do i achieve this? Regards Sudhindra

Re: output on stderr from `next'

2004-03-29 Thread Randy W. Sims
Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why

Re: output on stderr from `next'

2004-03-27 Thread Harry Putnam
"Randy W. Sims" <[EMAIL PROTECTED]> writes: > Use 'return' to exit from a subroutine. Use 'next', 'redo', 'last', > and 'goto' to alter the execution path in loop constructs; they must > appear /inside/ the block owned by the loop construct or within a > sub-block. Ahh, ok thanks. Return turns o

Re: output on stderr from `next'

2004-03-27 Thread Paul Johnson
On Sat, Mar 27, 2004 at 03:24:13PM -0500, Randy W. Sims wrote: > Harry Putnam wrote: > >I'm getting this output on stderr from a next clause: > > Exiting subroutine via next at ./test_bol.pl line 101. > > > >I wondered why this happens. Is it considered an err

Re: output on stderr from `next'

2004-03-27 Thread Randy W. Sims
Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why

output on stderr from `next'

2004-03-27 Thread Harry Putnam
I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why I put it there. S

Re: Redirect stdout, stderr to file and stdout

2004-01-20 Thread Jenda Krynicky
From: "Larry Guest" <[EMAIL PROTECTED]> > What I need to do now is not only have is display information to > STDERR and STDOUT but also write the same information I see when I run > the command to a file. Strange you only got a few Unix-only solutions when there are at

RE: Redirect stdout, stderr to file and stdout

2004-01-18 Thread Larry Guest
I think I have it. I had to have close (STDERR) close (STDOUT) close (TEE) -Original Message- From: Larry Guest [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 11:22 PM To: 'Randal L. Schwartz'; [EMAIL PROTECTED] Subject: RE: Redirect stdout, stderr to file and std

RE: Redirect stdout, stderr to file and stdout

2004-01-18 Thread Larry Guest
00:00:00 tee YourLogFileHere I have a close (TEE); at the end as well. Any thoughts? Thanks -Original Message- From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 9:55 AM To: [EMAIL PROTECTED] Subject: Re: Redirect stdout, stderr to file and stdout

Re: Redirect stdout, stderr to file and stdout

2004-01-17 Thread Randal L. Schwartz
>>>>> "Larry" == Larry Guest <[EMAIL PROTECTED]> writes: Larry> I have a small script that does some admin work for me. Larry> What I need to do now is not only have is display information to STDERR Larry> and STDOUT but also write the same information

Re: Redirect stdout, stderr to file and stdout

2004-01-16 Thread John McKown
On Fri, 16 Jan 2004, Larry Guest wrote: > I have a small script that does some admin work for me. > > What I need to do now is not only have is display information to STDERR > and STDOUT but also write the same information I see when I run the > command to a file. > >

Re: Redirect stdout, stderr to file and stdout

2004-01-16 Thread Paul Johnson
On Fri, Jan 16, 2004 at 05:02:52PM -0800, Larry Guest wrote: > I have a small script that does some admin work for me. > > What I need to do now is not only have is display information to STDERR > and STDOUT but also write the same information I see when I run the > command to

RE: Redirect stdout, stderr to file and stdout

2004-01-16 Thread Tim Johnson
print @_; print OUTFILE @_; } ### -Original Message- From: Larry Guest [mailto:[EMAIL PROTECTED] Sent: Friday, January 16, 2004 5:03 PM To: [EMAIL PROTECTED] Subject: Redirect stdout, stderr to file and stdout What I need to do now is not only have is displ

Re: Redirect stdout, stderr to file and stdout

2004-01-16 Thread drieux
On Jan 16, 2004, at 5:02 PM, Larry Guest wrote: I have a small script that does some admin work for me. What I need to do now is not only have is display information to STDERR and STDOUT but also write the same information I see when I run the command to a file. I have written it for others who

Redirect stdout, stderr to file and stdout

2004-01-16 Thread Larry Guest
I have a small script that does some admin work for me. What I need to do now is not only have is display information to STDERR and STDOUT but also write the same information I see when I run the command to a file. I have written it for others who are not very technical. I want them to be able

Re: Run one process and get the stdout and stderr

2003-10-16 Thread Steve Grazzini
On Thu, Oct 16, 2003 at 02:01:54PM +0200, [EMAIL PROTECTED] wrote: > Well this is good. > > But would be perfect to realy separate the STDERR from STDOUT. Probably will > have diferent colors in the output. Can you get me that please. It's right here: > #my $pid = o

RE: Run one process and get the stdout and stderr

2003-10-16 Thread Marcos . Rebelo
Well this is good. But would be perfect to realy separate the STDERR from STDOUT. Probably will have diferent colors in the output. Can you get me that please. Thanks Marcos -Original Message- From: zentara [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 1:56 PM To: [EMAIL

Run one process and get the stdout and stderr

2003-10-16 Thread Marcos . Rebelo
I need to run one program and get the stdout and stdin from it. If possible in real time. like: perl myscript.pl "perl -e 'foreach (1..5) {print 1; warn 2}; print \"end\"'" would print STDOUT: 1 STDERR: 2 STDOUT: 1 STDERR: 2 STDOUT: 1 STDERR: 2 STDOUT: end Pr

Re: reading STDERR

2003-09-11 Thread david
Trina Espinoza wrote: > I have this command that reads logfiles.However, if the command isn't > successful it gives me a standard error. > > my @logData= `program1 -log $data1 $data2`; > > > The error looks like this: > > program1: '//mnt/leah/dir/': The system cannot find the file specified

reading STDERR

2003-09-11 Thread Trina Espinoza
I have this command that reads logfiles.However, if the command isn't successful it gives me a standard error. my @logData= `program1 -log $data1 $data2`; The error looks like this: program1: '//mnt/leah/dir/': The system cannot find the file specified. *How do I read that error for the st

RE: catching STDERR

2003-07-28 Thread Marcos . Rebelo
well I found the answer to my question: use strict; use IPC::Open3; local(*stdin, *stdout, *stderr); open3(\*stdin, \*stdout, \*stderr, "perl testeSTDERR.pl"); print(join(", ", )); close *stdin; close *stdout; close *stderr; -Original Message- From: [EMAIL PROTE

catching STDERR

2003-07-28 Thread Marcos . Rebelo
join(", ", )); close FILE; ::: So I'm trying to get the STDERR. How do I do this? Thanks Marcos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: stdout+stderr to file?

2003-07-02 Thread mgoland
- Original Message - From: isao <[EMAIL PROTECTED]> Date: Tuesday, July 1, 2003 7:07 pm Subject: stdout+stderr to file? > I'm writing scripts that are basically wrappers for Linux shell > commands. > I want to be able to 1) print messages to screen along with say &

stdout+stderr to file?

2003-07-02 Thread isao
I'm writing scripts that are basically wrappers for Linux shell commands. I want to be able to 1) print messages to screen along with say the first line of any STDERR, and 2) print messages, STDOUT, and STDERR to go to a file. The best I've come up with is something like the follo

Re: Saving STDERR into a variable

2003-03-19 Thread zentara
d also do: > > sub readpipes { >require IPC::Open3; >my $pid = IPC::Open3::open3(my ($in, $out, $err), @_); There is a nice module to make ipc even easier than IPC::Open3, called Proc::Reliable #!/usr/bin/perl use Proc::Reliable; $myproc = Proc::Reliable->new(); ($out, $err, $

RE: Saving STDERR into a variable

2003-03-19 Thread Kipp, James
> >> > >> I was wondering if it's possible to save the error of > >> a DOS command from the error stream into a variable. > >> > > you could try the old 2>&1 trick > > $out = `$cmd 2>&1`; > > as others have mentioned, the above may depend on your which win32 OS you are using. works fine on my

Re: Saving STDERR into a variable

2003-03-19 Thread Steve Grazzini
James Kipp <[EMAIL PROTECTED]> wrote: > Navid M. <[EMAIL PROTECTED]> writes: >> >> I was wondering if it's possible to save the error of >> a DOS command from the error stream into a variable. >> > you could try the old 2>&1 trick > $out = `$cmd 2>&1`; > > or use system() and read the docs for

  1   2   >