|
Prev: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)
Next: IPC::Open3 : Why can't I catch program output here?
From: J�rgen Exner on 4 May 2008 09:37 "Ela" <ela(a)yantai.org> wrote: >In slave perl prog, there're some print codes. >However, when the master perl calling the slave one by system(command), the >slave perl print cannot be redirected to STDOUT. how to solve that? I cannot reproduce your problem: C:\tmp>type master.pl use strict; use warnings; system 'slave.pl'; C:\tmp>type slave.pl use strict; use warnings; print "Slave here\n"; C:\tmp>master.pl Slave here Obviously the slave program prints to STDOUT just fine. Please provide a minimal program that demonstrates your problem. jue
From: Ela on 4 May 2008 11:03 "Jo" <jo(a)nosp.invalid> wrote in message news:481d8b97$0$14343$e4fe514c(a)news.xs4all.nl... > Ela said: >> When running the slave prog directly by perl slave.pl, something is >> printed onto screen but >> perl master.pl (master.pl call salve.pl by > system) >> does not > > On my system it does. > Maybe you should post a simple example of master.pl and slave.pl > showing when it doesn't. > Oh sorry the perl is called by a master SHELL master.sh but not master perl... #!/bin/sh `perl slave.pl $dirname` So how to solve?
From: Lars Eighner on 4 May 2008 11:14 In our last episode, <fvkj8m$1pt$1(a)ijustice.itsc.cuhk.edu.hk>, the lovely and talented Ela broadcast on comp.lang.perl.misc: > "Jo" <jo(a)nosp.invalid> wrote in message > news:481d8b97$0$14343$e4fe514c(a)news.xs4all.nl... >> Ela said: >>> When running the slave prog directly by perl slave.pl, something is >>> printed onto screen but >>> perl master.pl (master.pl call salve.pl by > system) >>> does not >> >> On my system it does. Maybe you should post a simple example of master.pl >> and slave.pl showing when it doesn't. >> > Oh sorry the perl is called by a master SHELL master.sh but not master > perl... > #!/bin/sh > `perl slave.pl $dirname` > So how to solve? Don't use backticks. See man sh. -- Lars Eighner <http://larseighner.com/> usenet(a)larseighner.com Countdown: 261 days to go.
From: Jim Gibson on 4 May 2008 15:10 In article <fvkj8m$1pt$1(a)ijustice.itsc.cuhk.edu.hk>, Ela <ela(a)yantai.org> wrote: > "Jo" <jo(a)nosp.invalid> wrote in message > news:481d8b97$0$14343$e4fe514c(a)news.xs4all.nl... > > Ela said: > >> When running the slave prog directly by perl slave.pl, something is > >> printed onto screen but > >> perl master.pl (master.pl call salve.pl by > system) > >> does not > > > > On my system it does. > > Maybe you should post a simple example of master.pl and slave.pl > > showing when it doesn't. > > > > > Oh sorry the perl is called by a master SHELL master.sh but not master > perl... > > #!/bin/sh > `perl slave.pl $dirname` > > So how to solve? Send the output stream from your Perl program to STDOUT: #!/bin/sh echo `perl slave.pl $dirname` -- Jim Gibson Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- http://www.usenet.com
From: Joost Diepenmaat on 4 May 2008 15:13
Jim Gibson <jimsgibson(a)gmail.com> writes: > Send the output stream from your Perl program to STDOUT: > > #!/bin/sh > echo `perl slave.pl $dirname` or, you know: #!/bin/sh perl slave.pl $dirname -- Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/ |