RE: STDOUT

2007-03-22 Thread Jenda Krynicky
From: hOURS <[EMAIL PROTECTED]> > If you are on windows, then see perlfaq8 if ActiveState perl for > how to redirect STDOUT and STDERR when doing backticks. Believe where > you want to be at. > > Wags ;) > David R Wagner > > > David, are you saying this is definitely a Windows issue? I didn

RE: STDOUT

2007-03-21 Thread hOURS
"Wagner, David --- Senior Programmer Analyst --- WGO" <[EMAIL PROTECTED]> wrote: > -Original Message- > From: hOURS [mailto:[EMAIL PROTECTED] > Sent: Monday, March 19, 2007 13:17 > To: Perl Beginners > Subject: Re: STDOUT > > > > Jend

Re: STDOUT

2007-03-20 Thread Jenda Krynicky
From: hOURS <[EMAIL PROTECTED]> > if ($return =~ / syntax OK$/) { > print "$progname is OK\n"; > } else { > print "$progname has errors\n"; > } > } > > HTH, Jenda > > > > Thanks Jenda, > I definitely do just want to check syntax and not execute the scripts. > > I r

RE: STDOUT

2007-03-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: hOURS [mailto:[EMAIL PROTECTED] > Sent: Monday, March 19, 2007 13:17 > To: Perl Beginners > Subject: Re: STDOUT > > > > Jenda Krynicky <[EMAIL PROTECTED]> wrote: From: hOURS > > Hi, > > I wrote to

Re: STDOUT

2007-03-19 Thread hOURS
Jenda Krynicky <[EMAIL PROTECTED]> wrote: From: hOURS > Hi, > I wrote to the list with this issue before and got some suggestions, but > nothing worked. I ended up shelving it, but now would like to try again. > I have a thousand scripts I'd like to check for syntax errors. (Long story

Re: STDOUT

2007-03-19 Thread Jenda Krynicky
From: hOURS <[EMAIL PROTECTED]> > Hi, > I wrote to the list with this issue before and got some suggestions, > but nothing worked. I ended up shelving it, but now would like to try again. > I have a thousand scripts I'd like to check for syntax errors. (Long > story that.) A

Re: STDOUT

2007-03-19 Thread hOURS
Hi, I wrote to the list with this issue before and got some suggestions, but nothing worked. I ended up shelving it, but now would like to try again. I have a thousand scripts I'd like to check for syntax errors. (Long story that.) All I need is a list of which ones have er

Re: STDOUT

2006-09-19 Thread John W. Krahn
hOURS wrote: > > Thanks to John and Tom for suggesting "do" and "eval". I read up on those. > I don't understand them entirely, but I experimented. They seem to > accomplish about the same thing. I wrote two one-line programs:print > eval(system('perl -c nextprogramtoexecute.pl')); and

Re: STDOUT

2006-09-19 Thread hOURS
Thanks Travis, I'll give your code a shot, but every time I use backticks my computer crashes. Thanks to John and Tom for suggesting "do" and "eval". I read up on those. I don't understand them entirely, but I experimented. They seem to accomplish about the same thing. I wrote two one-l

Re: STDOUT

2006-09-19 Thread Travis Thornhill
Actually if the syntax is good the output will contain one line. If there are errors there will be multiple lines. This would work better: my $progname = "whatever.pl"; my @output = `perl -c $progname`; my $syntax_ok = 0; foreach my $line ( @output ) { if ( $line =~ /$progname sy

Re: STDOUT

2006-09-19 Thread Travis Thornhill
Would something like this (with backticks) work? It's probably not as robust as using 'do BLOCK' but it might work. #untested my $progname = "whatever.pl"; my $output = `perl -c $progname`; if ( $output =~ /$progname syntax OK/ ) { # It's good } else { # It's bad }

Re: STDOUT

2006-09-19 Thread John W. Krahn
hOURS wrote: > Hi all, Hello, > So, many thanks in advance to anyone who can tell me how to use > STDOUT for this. Or if you have another way to read that message > before the program quits, or another way to test for syntax > errors... that's cool too. perldoc -f do John -- use Perl; prog

Re: STDOUT

2006-09-19 Thread Tom Phoenix
On 9/19/06, hOURS <[EMAIL PROTECTED]> wrote: Asking it to 'require' a program with a syntax error will cause the main program to quit and print out the appropriate error message for that. I don't want that. I want it to keep going. You probably want 'eval', but also check out the document

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 subroutines written by yourself.In these subroutines,you log all ev

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 can `open( STDERR, '>', 'error

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, '>', 'error.log') .

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 redirect stderr: $!"; open(STDOUT, ">&STDERR") or die "Can't

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 > the first > line of

Re: stdout and error to one file

2002-05-21 Thread Michael Lamertz
On Mon, May 20, 2002 at 08:54:19PM -0700, [EMAIL PROTECTED] wrote: > Hi, > > I try to write a script that redirects its output, both out and error, to > a log-file, if it's possible to the screen as well. > > At the moment I'm doing this with > > open (FILE, ">whatever.txt"); > > open (STDOUT

Re: stdout and error to one file

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 08:54 , [EMAIL PROTECTED] wrote: > Hi, > > I try to write a script that redirects its output, both out and error, to > a log-file, if it's possible to the screen as well. > > At the moment I'm doing this with > > open (FILE, ">whatever.txt"); > > open (STDOUT, ">&FILE

Re: STDOUT

2002-03-06 Thread Jon Molin
walter valenti wrote: > > Hi, > > i've got a binary executable file, that give a result on STDOUT (shell). > I'm reditected STDOUT on a file as: > > use Getopt::Long; > open(STDOUT,">/usr/local/netsaint/var/tmp") || die"$!\n"; > &GetOptions("p=i" => \$port); > $|=1; > system("/usr/local/netsain

Re: STDOUT & STDERR

2002-02-18 Thread Jenda Krynicky
From: "Angus Laycock" <[EMAIL PROTECTED]> > I want to print messages from a script to either STDOUT or STDERR > depending on a value of a variable. I want to control where I send the > print statements to. Can I do something like this or are there other > ways to control the targ

Re: STDOUT & STDERR

2002-02-16 Thread John W. Krahn
Angus Laycock wrote: > > Hi, Hello, > I want to print messages from a script to either > STDOUT or STDERR depending on a value of a variable. > I want to control where I send the print statements > to. Can I do something like this or are there other > ways to control the target I send my messag

Re: STDOUT from system call

2002-01-20 Thread John W. Krahn
Craig Inman wrote: > > No, I'm not trying to capture the output of any of these. 'zowner' tells who the > file belongs to, if it fails, it will not return any output. I have tried using > > if (system ("zowner $claims[0]") != 1) > then claimsubmit the file > > but for some reason the 'zowne

Re: STDOUT from system call

2002-01-20 Thread Roger C Haslock
L PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, January 20, 2002 2:44 PM Subject: Re: STDOUT from system call > No, I'm not trying to capture the output of any of these. 'zowner' tells who the > file belongs to, if it fails, it will not return any output. I ha

Re: STDOUT from system call

2002-01-20 Thread Craig Inman
No, I'm not trying to capture the output of any of these. 'zowner' tells who the file belongs to, if it fails, it will not return any output. I have tried using if (system ("zowner $claims[0]") != 1) then claimsubmit the file but for some reason the 'zowner' program does not consistently ret

Re: STDOUT from system call

2002-01-19 Thread John W. Krahn
Craig Inman wrote: > > Trying to get this script to 'claimsubmit' ONLY if the system call > returns STDOUT, but I'm having a little trouble getting my script to > verify that and act accordingly. Do you mean you want to capture the output from claimsubmit? Use back-quotes (``) or qx//. > open

Re: stdout/stderr

2001-06-14 Thread Evgeny Goldin (aka Genie)
> I had another idea, but that is revert back to stupidity ;) > using system and sending the output to a file then open the file ;) Why not ? That's just fine

Re: stdout/stderr

2001-06-13 Thread Me
> What would be the easiest way to capture [stderr]? One way: $output = `$cmd 2>&1 1>$null`; $null depends on the os; /dev/null on unix, /nul on an M$ OS.