Re: Perl Fork and writing to stdout

2011-10-18 Thread John W. Krahn
sunckell wrote: Hello Perl People I was wondering if someone could enlighten me on an observation I have been seeing.. A little Background info: Where I work we have been seeing very slow ssh connections times (it's not DNS. Maybe NIS, NFS, but definitely not DNS). Anyw

Re: Perl Fork and writing to stdout

2011-10-18 Thread Brandon McCaig
On Mon, Oct 17, 2011 at 2:05 PM, sunckell wrote: > So here we are back to the script.. The script works as > expected, with one item of strangeness. I was expecting the > log messages to be printed in the order they complete. For > example, if the connection attempt at 12:01 took 75 seconds to > r

Perl Fork and writing to stdout

2011-10-18 Thread sunckell
quot;uname -n"; my $out = ""; sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!"; while () { chomp(); #print "$_\n"; $out = $_; } close(READER); close(WRITER); return $out; } # --- # ---

Re: script output => color highlight to stdout

2010-05-28 Thread Harry Putnam
trapd...@trapd00r.se writes: > And if you want to work with 256 colors (note that not all terminals support > this, and it should be avoided if it's not for your own use) you can do > something like this: > > > my @colors; > for(my $i=0;$i<256;$i++) { > push(@colors, "\033[38;5;$i".'m'); > } > p

Re: script output => color highlight to stdout

2010-05-28 Thread Eitan Adler
On Thu, May 27, 2010 at 6:22 PM, Harry Putnam wrote: > I wondered if anyone could steer me to some information about making > perl script output appear in color highlight on stdout. > > Something like what modern grep does on linux, where the searched term > appears in some col

Re: script output => color highlight to stdout

2010-05-28 Thread trapd00r
On 27/05/10 22:16 -0500, Bryan Harris wrote: my $e = "\033[0m"; my %cc = ( white => "\033[1;37m", ltgray => "\033[0;37m", gray => "\033[1;30m", black => "\033[0;30m", red => "\033[0;31m", ltred => "\033[1;31m", green => "\033[0;32m", l

Re: script output => color highlight to stdout

2010-05-28 Thread Bryan Harris
Try this > I wondered if anyone could steer me to some information about making > perl script output appear in color highlight on stdout. > > Something like what modern grep does on linux, where the searched term > appears in some color (red) in the output to tty. >

Re: script output => color highlight to stdout

2010-05-27 Thread Jim Gibson
At 10:22 AM -0500 5/27/10, Harry Putnam wrote: I wondered if anyone could steer me to some information about making perl script output appear in color highlight on stdout. Something like what modern grep does on linux, where the searched term appears in some color (red) in the output to tty

script output => color highlight to stdout

2010-05-27 Thread Harry Putnam
I wondered if anyone could steer me to some information about making perl script output appear in color highlight on stdout. Something like what modern grep does on linux, where the searched term appears in some color (red) in the output to tty. -- To unsubscribe, e-mail: beginners-unsubscr

RE: Having problems getting data back to STDOUT once I assign it to a file

2009-07-22 Thread Wagner, David --- Senior Programmer Analyst --- CFS
getting data back to STDOUT once > I assign it to a file > > > > This is how I got it to work. However any STDOUT completion > messages will need to be done outside the brace. > > } > > local *STDOUT; Ok, that seems do it. I have for the most part never u

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Shawn H. Corey
Uri Guttman wrote: "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >> >> print < >> All STDOUT/STDERR will be assigned to this scripts audittrail log!! >> All STDOUT/STDERR will be assigned to this scripts audittrail log!! >&

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Uri Guttman
>>>>> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >> >> print <> All STDOUT/STDERR will be assigned to this scripts audittrail log!! >> All STDOUT/STDERR will be assigned to this scripts audittrail log!! >> All STD

RE: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Patrick K Christopher TANAGER
This is how I got it to work. However any STDOUT completion messages will need to be done outside the brace. } local *STDOUT; if ( $GlblInfo{audit} ) { printf "All STDOUT/STDERR will be assigned to this scripts audittrail log!!\n"; printf "All STDOUT/STDERR will be a

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Shawn H. Corey
Uri Guttman wrote: ""D" == "Wagner, David <--- Senior Programmer Analyst --- CFS" > writes: "D> printf "All STDOUT/STDERR will be assigned to this scripts audittrail log!!\n"; "D> printf "All STDOUT/STDERR will be a

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Uri Guttman
>>>>> ""D" == "Wagner, David <--- Senior Programmer Analyst --- CFS" >>>>> > writes: "D> printf "All STDOUT/STDERR will be assigned to this scripts audittrail log!!\n"; "D> printf "All STDOU

RE: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Tony Esposito [mailto:tony1234567...@yahoo.co.uk] > Sent: Tuesday, July 21, 2009 08:08 > To: beginners@perl.org > Subject: Fw: Having problems getting data back to STDOUT once > I assign it to a file > > Back to the question at han

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Shawn H. Corey
Jay Savage wrote: On Tue, Jul 21, 2009 at 9:25 AM, Shawn H. Corey wrote: John W. Krahn wrote: [snip] close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you closed STDERR so the die me

Fw: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Tony Esposito
Back to the question at hand - have you tried using 'tee' use File::Tee qw(tee); # simple usage: tee(STDOUT, '>', 'stdout.txt'); Tony From: John W. Krahn To: Sent: Tuesday, 21 July, 2009 8:41:25 Subject: Re: Having problems

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Jay Savage
On Tue, Jul 21, 2009 at 9:25 AM, Shawn H. Corey wrote: > John W. Krahn wrote: [snip] >>>>        close(STDERR); >>>>        open(STDOUT , '>') || die "Unable to open STDOUT: $!"; >>> >>> You're not opening STDOUT to anyth

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread John W. Krahn
( $GlblInfo{audit} ) { printf "\n\n*Should be last line in the audittrail file...*\n\n"; close(STDOUT); close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you clo

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread John W. Krahn
;\n\n*Should be last line in the audittrail file...*\n\n"; close(STDOUT); close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you closed STDERR so the die message can&#x

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Shawn H. Corey
n the audittrail file...*\n\n"; close(STDOUT); close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you closed STDERR so the die message can't go anywhere. In fact, it

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread John W. Krahn
file...*\n\n"; close(STDOUT); close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you closed STDERR so the die message can't go anywhere. In fact, it goes into an infin

AW: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Thomas Bätzler
n. Try "perldoc -f select": select FILEHANDLE select Returns the currently selected filehandle. If FILEHANDLE is supplied, sets the new current default filehandle for output. [...] That way you could re-select() a previously saved handle to STDOUT. HTH, Thoma

Re: Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Shawn H. Corey
*\n\n"; close(STDOUT); close(STDERR); open(STDOUT , '>') || die "Unable to open STDOUT: $!"; You're not opening STDOUT to anything. And you closed STDERR so the die message can't go anywhere. In fact, it goes into an infinite loop. It can'

Having problems getting data back to STDOUT once I assign it to a file

2009-07-21 Thread Wagner, David --- Senior Programmer Analyst --- CFS
I am done processing and I want to place the final output line also on the screen. Here is what I have: if ( $GlblInfo{audit} ) { printf "\n\n*Should be last line in the audittrail file...*\n\n"; close(STDOUT); close(STDERR); o

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&#

Re: perl stdout errors due to called script does not exist

2009-02-02 Thread inetquestion
On Jan 28, 9:46 pm, r...@kuicr.kyoto-u.ac.jp (Raymond Wan) wrote: > Hi, > > inetquestionwrote: > > for the example perl script below is there a way to avoid errors from > > showing up in stdout if the shell script being called does not exist? > > The shell script bein

Re: perl stdout errors due to called script does not exist

2009-01-30 Thread inetquestion
On Jan 28, 9:46 pm, r...@kuicr.kyoto-u.ac.jp (Raymond Wan) wrote: > Hi, > > inetquestionwrote: > > for the example perl script below is there a way to avoid errors from > > showing up in stdout if the shell script being called does not exist? > > The shell script bein

Re: perl stdout errors due to called script does not exist

2009-01-28 Thread Raymond Wan
Hi, inetquestion wrote: for the example perl script below is there a way to avoid errors from showing up in stdout if the shell script being called does not exist? The shell script being called is not in the same directory as the perl script, but is in the path. Otherwise I would just do a

perl stdout errors due to called script does not exist

2009-01-28 Thread inetquestion
for the example perl script below is there a way to avoid errors from showing up in stdout if the shell script being called does not exist? The shell script being called is not in the same directory as the perl script, but is in the path. Otherwise I would just do a check to see if it exist

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: format magic and STDOUT

2007-11-09 Thread John W . Krahn
er value on the next lie? > $cps = check_ps($entry); > write PROC1_OUT; > } > > foreach $entry (@running_procs2) { > $entry =~ s/Element\s\:\s//g; > $entry =~ s/\s*Manager*//g; The pattern 'Manager*' matches 'Manage' or 'Manager' or

format magic and STDOUT

2007-11-09 Thread ajpavlis
cps . foreach $entry (@running_procs) { print "entered foreach\n" if ($DEBUG); $entry =~ s/Element\s\:\s//g; # check ps...for $entry. If running, print up, else print down. $cps = false; $cps = check_ps($entry); write PROC1_OUT; } foreach $entry (@runnin

Re: Filehandle and redirection of STDOUT

2007-11-02 Thread Paul Lalli
processes inherit their parent's STDIN, STDOUT, and STDERR. Try it and see for yourself, rather than telling the OP that his program is wrong. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Filehandle and redirection of STDOUT

2007-11-02 Thread Paul Lalli
On Nov 1, 10:49 pm, [EMAIL PROTECTED] (Phillip Gonzalez) wrote: > I'm trying to print stdout to a file, then switch back to the default > standard out so that it prints to the screen. This script takes a > list of ip's and does a reverse lookup on them, it then save

Re: Filehandle and redirection of STDOUT

2007-11-02 Thread John W . Krahn
On Thursday 01 November 2007 20:05, yitzle wrote: > > 1) You can use the backticks (``) or qx// quoting to capture the > output which you can then write to a file 1.5) Use piped open: open PIPE, '-|', 'host', '-W', '1', $ip or die "Cannot open pipe from 'host' $!"; > 2) Use the Perl select com

Re: Filehandle and redirection of STDOUT

2007-11-01 Thread Phillip Gonzalez
lly worked! LoL. Thanks, -phil On Nov 1, 2007, at 10:17 PM, Rob Dixon wrote: Phillip Gonzalez wrote: Hi, I'm trying to print stdout to a file, then switch back to the default standard out so that it prints to the screen. This script takes a list of ip's and does a reverse lookup on

Re: Filehandle and redirection of STDOUT

2007-11-01 Thread Rob Dixon
Phillip Gonzalez wrote: Hi, I'm trying to print stdout to a file, then switch back to the default standard out so that it prints to the screen. This script takes a list of ip's and does a reverse lookup on them, it then saves the output to "reverse.txt". Here's m

Re: Filehandle and redirection of STDOUT

2007-11-01 Thread yitzle
1) You can use the backticks (``) or qx// quoting to capture the output which you can then write to a file 2) Use the Perl select command. From the Perldoc: select FILEHANDLE ... a write or a print without a filehandle will default to this FILEHANDLE 3) Use the shell's own redirection. See http:/

Filehandle and redirection of STDOUT

2007-11-01 Thread Phillip Gonzalez
Hi, I'm trying to print stdout to a file, then switch back to the default standard out so that it prints to the screen. This script takes a list of ip's and does a reverse lookup on them, it then saves the output to "reverse.txt". Here's my code: #!/usr/

Re: Redirecting file handler to STDOUT (SOLVED)

2007-06-22 Thread Paul Lalli
On Jun 22, 1:43 pm, [EMAIL PROTECTED] (Ben Edwards) wrote: > Cool, the * is by reference. If you re-read my post, you will see the word "reference" no where in it. This has nothing to do with references. It involves typeglobs. By the way, this is now the third time (that I've noticed) that you'

Re: Redirecting file handler to STDOUT (SOLVED)

2007-06-22 Thread Chas Owens
On 6/22/07, Ben Edwards <[EMAIL PROTECTED]> wrote: Cool, the * is by reference. snip It is a lot more complicated than that. Typeglobs allow you access to the symbol table. You can do some really cool things like *hw = sub { print "Hello, ", shift, "\n" }; hw("bork") -- To unsubscribe, e-ma

Re: Redirecting file handler to STDOUT (SOLVED)

2007-06-22 Thread Ben Edwards
s of places. > > I have been asked to change the program so if -m (manual) flag is > passed the stuff that goes to the log file is send to standard out > instead. Is it possible to change the above command to redirect > LOGFILE to STDOUT (i.e. make the two the same thing. > > i.e

Re: Redirecting file handler to STDOUT

2007-06-22 Thread Paul Lalli
uff that goes to the log file is send to standard out > instead. Is it possible to change the above command to redirect > LOGFILE to STDOUT (i.e. make the two the same thing. > > i.e. > > if ( defined( $opt_m ) ) { > open( LOGFILE, STDOUT );} else { > > open( LOGFIL

Re: Redirecting file handler to STDOUT

2007-06-22 Thread Xavier Noria
to standard out instead. Is it possible to change the above command to redirect LOGFILE to STDOUT (i.e. make the two the same thing. Given those requirements, a simple solution would be: unless (m_flag_given) { open my $fh, '>>cronlog.txt' or die $!; select $fh; }

Redirecting file handler to STDOUT

2007-06-22 Thread Ben Edwards
above command to redirect LOGFILE to STDOUT (i.e. make the two the same thing. i.e. if ( defined( $opt_m ) ) { open( LOGFILE, STDOUT ); } else { open( LOGFILE, ">>cronlog.txt" ); } I even tried: LOGFILE = STDOUT; But I get: Bareword "STDOUT" not allowed while &q

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: 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

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: 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

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
rse, but there's also the -c option. I thought I could put a line in the main program like system('perl -c nextprogramtoexecute.pl'); and check to see if that gives me a syntax OK message or not. But I can't figure out how to get a hold of the message. I figured it would be

Re: STDOUT

2006-09-19 Thread Travis Thornhill
could put a line in the main program like system('perl -c nextprogramtoexecute.pl'); and check to see if that gives me a syntax OK message or not. But I can't figure out how to get a hold of the message. I figured it would be in STDOUT, but I can't figure out how to make use

Re: STDOUT

2006-09-19 Thread Travis Thornhill
ogramtoexecute.pl'); and check to see if that gives me a syntax OK message or not. But I can't figure out how to get a hold of the message. I figured it would be in STDOUT, but I can't figure out how to make use of that. I have a PERL textbook in front of me, but it says precious

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

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

STDOUT

2006-09-19 Thread hOURS
xecute.pl'); and check to see if that gives me a syntax OK message or not. But I can't figure out how to get a hold of the message. I figured it would be in STDOUT, but I can't figure out how to make use of that. I have a PERL textbook in front of me, but it says preciou

Re: can't print to STDOUT on 5.8.4

2006-09-05 Thread Mumia W.
hy this is happening? Thanks. First of all, FLOWTOOLS is not STDOUT. You can't use "less" this way. "Less" is supposed to be used on an interactive terminal. I know nothing about the flow-tools. What are you trying to do? -- To unsubscribe, e-mail: [EMAIL PROTECT

can't print to STDOUT on 5.8.4

2006-09-04 Thread Michael Alipio
Hi, I was running this command on my perl program, open FLOWTOOLS, "|/usr/bin/flow-cat $start | /usr/bin/flow-nfilter -f filter.tmp -F $direction |/usr/bin/flow-stat -Pf8 | le ss" or die $!; It does output something on the screen when I run it on FreeBSD 6.1/perl 5.8.8 (while on csh) However, w

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
an `open( STDERR, '>', 'error.log') ...` but is there a piece of magic to duplicate that to STDOUT as well (ie same file output) Ta Ken Foskey From command line, you could use tee( man 1 tee). After a quick search, I found a perl module that presumably does the sam

Re: STDOUT and STDERR to same file

2006-08-29 Thread Mumia W.
;>', 'error.log') ...` but is there a piece of magic to duplicate that to STDOUT as well (ie same file output) Ta Ken Foskey "Perldoc -f open" shows you how to create duplicate file handles, e.g.: use strict; use warnings; open (FH, '>out') or die(&qu

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
but is there a piece of magic to duplicate that to STDOUT as well (ie same file output) Ta Ken Foskey -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: accidently changed stdout | can't print to screen

2006-03-07 Thread Earthlink-m_ryan
thinbrowser wrote: also, try printing in a editor that captures ouput, and also allows you to submit arguments just like on a command prompt. Crimson Editor (windoz freeware) does that. Let us know if anything you try .. works? Thanks for all the great advice. I was able to track down the pro

Re: Redirecting STDOUT to an array

2006-02-12 Thread Chas Owens
On 2/12/06, Ron Smith <[EMAIL PROTECTED]> wrote: snip > Yeah, I deserve it. Giving the whole story in the beginning would have been > better. But, > hey I'm JAPH and laziness is a virtue in that case. :-) Anyway the "push" > does just fine. snip There is a difference between laziness (a sin) and

Re: Redirecting STDOUT to an array

2006-02-12 Thread Ron Smith
Tom Phoenix <[EMAIL PROTECTED]> wrote: Inexplicably, Ron Smith seems to have written: > Yes, you are right. I probably should post the rest of the story at this > point: > and I'd like to generate a row of asterisks, based on the number stored in > $firstBar. I thought of printing to a file th

Re: Redirecting STDOUT to an array

2006-02-12 Thread Tom Phoenix
Inexplicably, Ron Smith <[EMAIL PROTECTED]> seems to have written: > Yes, you are right. I probably should post the rest of the story at this > point: > and I'd like to generate a row of asterisks, based on the number stored in > $firstBar. I thought of printing to a file then splitting the co

Re: Redirecting STDOUT to an array

2006-02-12 Thread Ron Smith
Tom Phoenix <[EMAIL PROTECTED]> wrote: On 2/12/06, Ron Smith wrote: > How would I redirect the output of the print line to an array instaed of > STDOUT? > > my $firstBar = 5; > print "*" while $firstBar, $firstBar--; You would write some Perl code that puts s

Re: Redirecting STDOUT to an array

2006-02-12 Thread Ron Smith
Sky Blueshoes <[EMAIL PROTECTED]> wrote: Ron Smith wrote: >Hi all, > > How would I redirect the output of the print line to an array instaed of > STDOUT? > > my $firstBar = 5; > print "*" while $firstBar, $firstBar--; > > I've looked in

Re: Redirecting STDOUT to an array

2006-02-12 Thread Tom Phoenix
On 2/12/06, Ron Smith <[EMAIL PROTECTED]> wrote: > How would I redirect the output of the print line to an array instaed of > STDOUT? > > my $firstBar = 5; > print "*" while $firstBar, $firstBar--; You would write some Perl code that puts something into an a

Redirecting STDOUT to an array

2006-02-12 Thread Ron Smith
Hi all, How would I redirect the output of the print line to an array instaed of STDOUT? my $firstBar = 5; print "*" while $firstBar, $firstBar--; I've looked in several places, including the Camel Book and the Cookbook. Everything seems to be refering to a fil

Problem with STDOUT redirect

2006-01-22 Thread John Maverick
I am trying to write a wrapper to invoke a script which takes input from STDIN. I am opening a filehandle so that I can store all information returned by invoked script. However, it hangs when second script is waiting for user input. Input varies from time to time. So, I can't use open(SCRIPT,

RE: route STDOUT to file

2005-06-27 Thread Bakken, Luke
Manish Sapariya wrote: > I use screen as my tool to deal with unstable network connection. > Its command line version of vncviewer. > > Screen dameon allows me to reconnect the previously opened screen, > if I by mistake detache or exit the current shell, or network forces > my connection down. H

Re: route STDOUT to file

2005-06-27 Thread Manish Sapariya
ely disconnected, and I'd still lose the output. Is there a way or saying that every STDOUT, STDERR, die(), exit(), and any error messages can be appended to a specified logfile, so I can maybe track this bug? I've done a search on google for logging STDOUT and things, most results of which g

Re: route STDOUT to file

2005-06-25 Thread John W. Krahn
ld, so this session may end up being prematurely disconnected, and I'd still lose the output. Is there a way or saying that every STDOUT, STDERR, die(), exit(), and any error messages can be appended to a specified logfile, so I can maybe track this bug? I've done a search on goo

RE : route STDOUT to file

2005-06-25 Thread Jose Nyimi
> -Message d'origine- > De : [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] De la part de zentara > Envoyé : samedi 25 juin 2005 13:36 > À : beginners@perl.org > Objet : Re: route STDOUT to file > > > There are a whole bunch of different ways, ... >

Re: route STDOUT to file

2005-06-25 Thread John W. Krahn
this session may end up being prematurely disconnected, and I'd still lose the output. Is there a way or saying that every STDOUT, STDERR, die(), exit(), and any error messages can be appended to a specified logfile, so I can maybe track this bug? I've done a search on google for logging STDOU

route STDOUT to file

2005-06-25 Thread dan
ere a way or saying that every STDOUT, STDERR, die(), exit(), and any error messages can be appended to a specified logfile, so I can maybe track this bug? I've done a search on google for logging STDOUT and things, most results of which give me modules which I don't really understand how it

Re: One liner to process stdin/stdout similar "in place edit", grep, cut and awk ($5 PayPal reward for the best answer!)

2005-05-18 Thread Jeff 'japhy' Pinyan
On May 18, Lance Murray said: perl -i -p -e "s/oldhostname/newhostname/g" /etc/hosts However, what is the syntax if I wanted to just process a text stream to stdout?, e.g.: cat /etc/hosts | perl "s/in_text/out_text/g" Simple: use the -p and -e switches, but not the -i sw

  1   2   3   >