[26255] in Perl-Users-Digest
Perl-Users Digest, Issue: 8439 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 21 06:05:26 2005
Date: Wed, 21 Sep 2005 03:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 21 Sep 2005 Volume: 10 Number: 8439
Today's topics:
how to call exec multi-times... <jianli@cc.gatech.edu>
Re: how to call exec multi-times... <1usa@llenroc.ude.invalid>
Re: how to call exec multi-times... <jurgenex@hotmail.com>
Re: how to call exec multi-times... <jianli@cc.gatech.edu>
Re: how to call exec multi-times... <someone@example.com>
Re: How to clear $1 's values ? <djames@thehub.com.au>
script to run the program <a@mail.com>
Re: script to run the program <josef.moellers@fujitsu-siemens.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Sep 2005 00:34:50 -0400
From: "Jianli Shen" <jianli@cc.gatech.edu>
Subject: how to call exec multi-times...
Message-Id: <dgqnvp$mgj$1@news-int.gatech.edu>
Hi,
I write the following script,
hope it call "atouRcv -b ***** & " in each iteration.
however, it only call once when $port=6811
is that because: exec will not call the END block, nor will it call any
DESTROY method in the object ???
how can I make this loop work ??
Thanks
#!/usr/bin/perl
my $port=6811;
foreach my $r ( 0, 50, 200 ){
foreach my $l (0, 0.01, 0.05){
for (my $i=0; $i<=9; $i++) { #each run 10times
exec "atouRcv -b 2000000 -r ". $r . " -l ". $l . " -p " . $port . " &
";
$port += 1;
}
}
}
------------------------------
Date: Wed, 21 Sep 2005 04:51:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: how to call exec multi-times...
Message-Id: <Xns96D88B1952B2asu1cornelledu@127.0.0.1>
"Jianli Shen" <jianli@cc.gatech.edu> wrote in
news:dgqnvp$mgj$1@news-int.gatech.edu:
> is that because: exec will not call the END block, nor will it call
> any DESTROY method in the object ???
perldoc -f exec
exec LIST
exec PROGRAM LIST
The "exec" function executes a system command *and never
returns* ...
Read the documentation for more information.
Have you seen the posting guidelines for this group?
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 21 Sep 2005 04:58:36 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: how to call exec multi-times...
Message-Id: <0M5Ye.15907$fb6.2962@trnddc08>
Jianli Shen wrote:
> I write the following script,
> hope it call "atouRcv -b ***** & " in each iteration.
How would that be? The program that is started via "exec" _replaces_ your
Perl program.
After calling exec once there is nothing left that could possibly iterate
anything.
> however, it only call once when $port=6811
Yeah, that's the documented behaviour of exec().
> is that because: exec will not call the END block, nor will it call
> any DESTROY method in the object ???
No, it is because a successful exec() never returns to begin with.
> how can I make this loop work ??
Use the proper tool. Maybe you were looking for system() instead?
jue
------------------------------
Date: Wed, 21 Sep 2005 00:58:06 -0400
From: "Jianli Shen" <jianli@cc.gatech.edu>
Subject: Re: how to call exec multi-times...
Message-Id: <dgqpbf$n1j$1@news-int.gatech.edu>
Yes, I have read the perldoc,
is that put all the command to a command list then call exec ??
Thanks
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns96D88B1952B2asu1cornelledu@127.0.0.1...
> "Jianli Shen" <jianli@cc.gatech.edu> wrote in
> news:dgqnvp$mgj$1@news-int.gatech.edu:
>
>> is that because: exec will not call the END block, nor will it call
>> any DESTROY method in the object ???
>
> perldoc -f exec
>
> exec LIST
> exec PROGRAM LIST
> The "exec" function executes a system command *and never
> returns* ...
>
> Read the documentation for more information.
>
> Have you seen the posting guidelines for this group?
>
> Sinan
> --
> A. Sinan Unur <1usa@llenroc.ude.invalid>
> (reverse each component and remove .invalid for email address)
>
> comp.lang.perl.misc guidelines on the WWW:
> http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 21 Sep 2005 06:29:08 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: how to call exec multi-times...
Message-Id: <U47Ye.180361$wr.49329@clgrps12>
Jianli Shen wrote:
>
> I write the following script,
> hope it call "atouRcv -b ***** & " in each iteration.
> however, it only call once when $port=6811
>
> is that because: exec will not call the END block, nor will it call any
> DESTROY method in the object ???
>
> how can I make this loop work ??
>
>
> #!/usr/bin/perl
>
> my $port=6811;
> foreach my $r ( 0, 50, 200 ){
> foreach my $l (0, 0.01, 0.05){
> for (my $i=0; $i<=9; $i++) { #each run 10times
> exec "atouRcv -b 2000000 -r ". $r . " -l ". $l . " -p " . $port . " &
> ";
> $port += 1;
> }
> }
> }
Perhaps you want something like (UNTESTED):
#!/usr/bin/perl
use warnings;
use strict;
my $port = 6811;
for my $r ( 0, 50, 200 ) {
for my $l ( 0, 0.01, 0.05 ) {
for ( 1 .. 10 ) { # each run 10 times
defined( my $pid = fork ) or die "Cannot fork: $!";
$pid or exec 'atouRcv', '-b', 2000000, '-r', $r, '-l', $l, '-p', $port;
$port++;
}
}
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 21 Sep 2005 16:42:46 +1000
From: Damian James <djames@thehub.com.au>
Subject: Re: How to clear $1 's values ?
Message-Id: <slrndj2076.6td.djames@stumble.qimr.edu.au>
On Tue, 20 Sep 2005 12:12:46 +0100, Brian McCauley said:
> Graham Wood wrote:
>> if($a =~/ node\=['|"](.*?)['|"][ |>|\/>]/){
>> $node = $1;
>> }
>
> Or, a better idiom IMNSO...
^
You're dropping your aitches :-).
> my ($node) = $a =~/ node\=['|"](.*?)['|"][ |>|\/>]/;
or indeed:
my $node = ($a =~ / node\=['|"](.*?)['|"][ |>|\/>]/)[0];
--Damian
------------------------------
Date: Wed, 21 Sep 2005 06:45:16 GMT
From: "a" <a@mail.com>
Subject: script to run the program
Message-Id: <0k7Ye.535652$s54.520820@pd7tw2no>
I need to run a program that need input at run time.
Is it possible to simulate this by perl?
Thanx
------------------------------
Date: Wed, 21 Sep 2005 09:16:34 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: script to run the program
Message-Id: <dgr17n$qh8$2@nntp.fujitsu-siemens.com>
a wrote:
> I need to run a program that need input at run time.
> Is it possible to simulate this by perl?
> Thanx
>=20
>=20
It depends.
You can open a pipe to the program and send the input through the pipe=20
(beware of buffering):
open(DST, '|', $program);
print DST "Input\n";
Or look at Perl/Expect.
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8439
***************************************