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
"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
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
> -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
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
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
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
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
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
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
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
}
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
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
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
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
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') .
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
- 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
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
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
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
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
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
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
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
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
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
> 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
> 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.
29 matches
Mail list logo