RE: system();

2000-05-23 Thread Bellenger, Bruno (Paris)

All of this will work if you specify your command as 

perl gettag.pl -q $TagName

instead of just 

gettag.pl -q $TagName


Shortcuts and associations are often handy, but 
you have to remember that they are just that, 
and keep in mind that they can't be used  everywhere.

_
Bruno Bellenger
Sr. Network/Systems Administrator 

-Original Message-
From:   Fauzi Ashurex [SMTP:[EMAIL PROTECTED]]
Sent:   Monday, May 22, 2000 19:14
To: Perl-Win32-Users Mailing List
Subject:RE: system();


I want to execute "gettag.pl -q TagName" and capture the output of
the
command, I have tried different ways, but no luck! 
The "gettag.pl -q TagName" will return one "1" if it's true, the
TagName
exist in the Tagdb, else will return zero "0", so I would like to
capture
the "1" and the "0"

1- open(FOO, "gettag.pl -q $TagName |");
while (FOO) {
   chop;
print $_;
} 

* Nothing happens here?

2- $Tag = system ("gettag.pl -q $TagName") ;
print "Tag: $Tag";

* Two things happen here:
A- If true will print to the screen
 1 -- from the call to system
Tag:0   -- from print

B- if not true will print to the screen
0 -- from the call to system
   Tag:0   -- from print

 But I could not capture it into a variable that I can manipulate

3- @Gettag_Return = `gettag.pl -q $TagName` ;
   foreach $get_line (@Gettag_Return) {
  print "$get_line";
}

* Nothing happen


I have used all those techniques in the past and I know they should
work! 
Am I missing something?

Thanks for any advice.
-Fauzi

-Original Message-
From: Bellenger, Bruno (Paris) [mailto:[EMAIL PROTECTED]]
        Sent: Sunday, May 21, 2000 11:55 PM
To: Perl-Win32-Users Mailing List
Subject: RE: system();


"Hogue, Jon" wrote:
 I want to run a dos command and play with the output of
the
command.
 
 For example,
 
 If I do system("foo.exe"), how do I get the ouput of
foo.exe.
(not the exit
 status).

Open it in a pipe:
#open(FOO, "foo.exe|");

open(FOO, "foo.exe| 21");
# adding '21' will get you what foo.exe writes to STDERR too, 
# not just STDOUT
# An alternative if you're not expecting lots of lines is the
simpler :
@foo_return = `foo.exe` ; 
# Note : The above uses backticks, not single quotes.
# Each element of @foo_return now contains one line of foo.exe's 
# output (including the newline/carriage return char.).

(Note: I've assumed this works on Perl-Win32. I've only used it on
Unix.)

It does work on WIN32.

Hamish
Hamish Moffatt   Email: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
RD Engineer,Phone: +61 3 9210 5782
Advanced Networks Division   Fax:   +61 3 9210 5550
Agilent Technologies Web:   http://www.agilent.com/
http://www.agilent.com/ 


Cheers.

_
Bruno Bellenger
Sr. Network/Systems Administrator 



---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-22 Thread Bellenger, Bruno (Paris)

"Hogue, Jon" wrote:
 I want to run a dos command and play with the output of the
command.
 
 For example,
 
 If I do system("foo.exe"), how do I get the ouput of foo.exe.
(not the exit
 status).

Open it in a pipe:
#open(FOO, "foo.exe|");

open(FOO, "foo.exe| 21");
# adding '21' will get you what foo.exe writes to STDERR too, 
# not just STDOUT
# An alternative if you're not expecting lots of lines is the simpler :
@foo_return = `foo.exe` ; 
# Note : The above uses backticks, not single quotes.
# Each element of @foo_return now contains one line of foo.exe's 
# output (including the newline/carriage return char.).

(Note: I've assumed this works on Perl-Win32. I've only used it on Unix.)

It does work on WIN32.

Hamish
Hamish Moffatt   Email: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
RD Engineer,Phone: +61 3 9210 5782
Advanced Networks Division   Fax:   +61 3 9210 5550
Agilent Technologies Web:   http://www.agilent.com/
http://www.agilent.com/ 


Cheers.

_
Bruno Bellenger
Sr. Network/Systems Administrator 



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-22 Thread Joe Schell

'21' works on WinNT.  I am not so confident that it works in the standard
shell for win 9x.  Has anyone verified this?

 Behalf Of Bellenger, Bruno (Paris)


 "Hogue, Jon" wrote:
I want to run a dos command and play with the output of the
 command.
   
For example,
   
If I do system("foo.exe"), how do I get the ouput of foo.exe.
 (not the exit
status).

 Open it in a pipe:
 #open(FOO, "foo.exe|");

 open(FOO, "foo.exe| 21");
 # adding '21' will get you what foo.exe writes to STDERR too,
 # not just STDOUT
 # An alternative if you're not expecting lots of lines is the simpler :
 @foo_return = `foo.exe` ;
 # Note : The above uses backticks, not single quotes.
 # Each element of @foo_return now contains one line of foo.exe's
 # output (including the newline/carriage return char.).

 (Note: I've assumed this works on Perl-Win32. I've only used it on Unix.)

 It does work on WIN32.



---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-22 Thread Fauzi Ashurex


I want to execute "gettag.pl -q TagName" and capture the output of the
command, I have tried different ways, but no luck! 
The "gettag.pl -q TagName" will return one "1" if it's true, the TagName
exist in the Tagdb, else will return zero "0", so I would like to capture
the "1" and the "0"

1- open(FOO, "gettag.pl -q $TagName |");
while (FOO) {
   chop;
print $_;
} 

* Nothing happens here?

2- $Tag = system ("gettag.pl -q $TagName") ;
print "Tag: $Tag";

* Two things happen here:
A- If true will print to the screen
 1 -- from the call to system
Tag:0   -- from print

B- if not true will print to the screen
0 -- from the call to system
   Tag:0   -- from print

 But I could not capture it into a variable that I can manipulate

3- @Gettag_Return = `gettag.pl -q $TagName` ;
   foreach $get_line (@Gettag_Return) {
  print "$get_line";
}

* Nothing happen


I have used all those techniques in the past and I know they should work! 
Am I missing something?

Thanks for any advice.
-Fauzi

-Original Message-
From: Bellenger, Bruno (Paris) [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 21, 2000 11:55 PM
To: Perl-Win32-Users Mailing List
Subject: RE: system();


"Hogue, Jon" wrote:
 I want to run a dos command and play with the output of the
command.
 
 For example,
 
 If I do system("foo.exe"), how do I get the ouput of foo.exe.
(not the exit
 status).

Open it in a pipe:
#open(FOO, "foo.exe|");

open(FOO, "foo.exe| 21");
# adding '21' will get you what foo.exe writes to STDERR too, 
# not just STDOUT
# An alternative if you're not expecting lots of lines is the simpler :
@foo_return = `foo.exe` ; 
# Note : The above uses backticks, not single quotes.
# Each element of @foo_return now contains one line of foo.exe's 
# output (including the newline/carriage return char.).

(Note: I've assumed this works on Perl-Win32. I've only used it on Unix.)

It does work on WIN32.

Hamish
Hamish Moffatt   Email: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] 
RD Engineer,Phone: +61 3 9210 5782
Advanced Networks Division   Fax:   +61 3 9210 5550
Agilent Technologies Web:   http://www.agilent.com/
http://www.agilent.com/ 


Cheers.

_
Bruno Bellenger
Sr. Network/Systems Administrator 



---
You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-22 Thread Frank Merrow

I am jumping in the middle of this tread without the whole thing . .
.

However, this isn't the old CMD.EXE redirection problem is it?

STDOUT isn't redirected properly in some cases. It has to do with
the nice magic CMD.EXE will do if you do things like type
sheet.xls at the command prompt. They eat STDOUT
thinking your a GUI process when in fact you are a Perl process.

IF this is the problem, then the following should fix it assuming
perl.exe is in your path:

open(FOO, perl gettag.pl -q $TagName
|)

Frank

At 10:14 AM 5/22/00, Fauzi Ashurex wrote:

I want to execute gettag.pl -q
TagName and capture the output of the
command, I have tried different ways, but no luck! 
The gettag.pl -q TagName will return one 1 if
it's true, the TagName
exist in the Tagdb, else will return zero 0, so I would like
to capture
the 1 and the 0

1- open(FOO, gettag.pl -q $TagName |);
 while (FOO) {

chop;

print $_;
 } 

* Nothing happens here?

2- $Tag = system (gettag.pl -q $TagName) ;
 print Tag: $Tag;

* Two things happen here:
A- If true
will print to the screen

1 -- from the call to
system

Tag:0 -- from print

B- if not
true will print to the screen

0 -- from the call to
system

Tag:0 -- from print

But I could not capture it into a variable that I can
manipulate

3- @Gettag_Return = `gettag.pl -q $TagName` ;
 foreach
$get_line (@Gettag_Return) {

print $get_line;
 
}

* Nothing happen


I have used all those techniques in the past and I know they should work!

Am I missing something?

Thanks for any advice.
-Fauzi

-Original Message-
From: Bellenger, Bruno (Paris)
[mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 21, 2000 11:55 PM
To: Perl-Win32-Users Mailing List
Subject: RE: system();


Hogue, Jon wrote:
 I
want to run a dos command and play with the output of the
command.



For example,



If I do system(foo.exe), how do I get the ouput of
foo.exe.
(not the exit

status).

Open it in a pipe:
#open(FOO, foo.exe|);

open(FOO, foo.exe| 21);
# adding '21' will get you what foo.exe writes to STDERR too,

# not just STDOUT
# An alternative if you're not expecting lots of lines is the simpler
:
@foo_return = `foo.exe` ; 
# Note : The above uses backticks, not single quotes.
# Each element of @foo_return now contains one line of foo.exe's 
# output (including the newline/carriage return char.).

(Note: I've assumed this works on Perl-Win32. I've only used it on
Unix.)

It does work on WIN32.

Hamish
Hamish
Moffatt
Email: [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

RD
Engineer,
Phone: +61 3 9210 5782
Advanced Networks Division
Fax: +61 3 9210 5550
Agilent
Technologies
Web:
http://www.agilent.com/
http://www.agilent.com/



Cheers.

_
Bruno Bellenger
Sr. Network/Systems Administrator 



---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to

[EMAIL PROTECTED]
For non-automated Mailing List support, send email to 

[EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to

[EMAIL PROTECTED]
For non-automated Mailing List support, send email to 

[EMAIL PROTECTED]


RE: system();

2000-05-22 Thread Hogue, Jon


 2- $Tag = system ("gettag.pl -q $TagName") ;
 print "Tag: $Tag";
 
 * Two things happen here:
   A- If true will print to the screen
  1 -- from the call to system
   Tag:0   -- from print
 
   B- if not true will print to the screen
   0 -- from the call to system
  Tag:0   -- from print
 
  But I could not capture it into a variable that I can manipulate
 
 

in gettag.pl, use

exit 1; # if true
or
exit 0; # if false

at the end of your script.

That should make #2 work.

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-22 Thread Joe Schell

The questions are not related.

How are you executing it?

Using this in temp.pl

print @ARGV;

And a command line of

perl temp.pl red yellow blue

I get this output

redyellowblue

Which is what I would expect.

 On Behalf Of Peter Eisengrein
 
 
 Similar question... in Win32, it doesn't seem 
 to read in @ARGV, unless I'm just being dense. 
 For example, a one line script:
 
print @ARGV;

 When executed as follows:
 
foo.pl red blue yellow
 
 You'd expect the STDOUT to be "red blue yellow". It 
 executes and exits without error, yet it doesn't 
 give any output. Any ideas?


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




Re: system();

2000-05-21 Thread Hamish Moffatt

"Hogue, Jon" wrote:
 I want to run a dos command and play with the output of the command.
 
 For example,
 
 If I do system("foo.exe"), how do I get the ouput of foo.exe. (not the exit
 status).

Open it in a pipe:

open(FOO, "foo.exe|");

while (FOO) {
# blah
}

close(FOO);

(Note: I've assumed this works on Perl-Win32. I've only used
it on Unix.)


Hamish
-- 
Hamish Moffatt   Email: [EMAIL PROTECTED]
RD Engineer,Phone: +61 3 9210 5782
Advanced Networks Division   Fax:   +61 3 9210 5550
Agilent Technologies Web:   http://www.agilent.com/

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]




RE: system();

2000-05-16 Thread Pires Claudio

do:
$output = ` foo.exe `;

Claudio

-Mensaje original-
De: Hogue, Jon [mailto:[EMAIL PROTECTED]]
Enviado el: Tuesday, May 16, 2000 4:11 PM
Para: Perl-Win32-Users Mailing List
Asunto: system();


I want to run a dos command and play with the output of the command.

For example, 

If I do system("foo.exe"), how do I get the ouput of foo.exe. (not the exit
status).

---
You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
 [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
 [EMAIL PROTECTED]