LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-24-2004, 04:39 PM   #1
patator
LQ Newbie
 
Registered: Jun 2004
Posts: 2

Rep: Reputation: 0
[Perl] brainstorming with pipes & commands


Hi all !
I have something like that :

open(FH,"command1 | command2 | command3 |");

These three commands must run together.
*command1 send on stdout a stream that command2 and command3 process
*BUT command1 send a progress in % on stderr and I MUST get it.
( I can't run command1 separately => creating a 5Go file !!! )

HOW CAN I DO THAT ????

->doing an:
open(FH,"command1 2>error.txt | command2 | command3 |");
and reading+processing error.txt ?

->CAN PERL DO SOMETHING LIKE THIS ?
## wrong code !!

1) open(PIPE);
2) open(FH,"command1 2>PIPE | command2 | command3 |");
3) while(<PIPE>) {
process the stderr
}

Well, I've been searching for 2 days but I can't find anything suitable.
Have an idea of something equivalent ?????

BIG THANX for your answers !! ;o)=
Patator da FiRsT
 
Old 06-24-2004, 04:51 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Welcome to LQ.

Can't you just read in from <STDER>?
 
Old 06-24-2004, 06:22 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
Try IPC::Open3. (perldoc IPC::Open3) I think it's installed by default, could be wrong.

I don't think that reading from <STDERR> is going to work.
 
Old 06-25-2004, 04:17 AM   #4
patator
LQ Newbie
 
Registered: Jun 2004
Posts: 2

Original Poster
Rep: Reputation: 0
BIG THANX aluser !!!!
IPC::Open3 does a wonderfull job !!!!! ;o)=
That's so easy now !!!

THANX All !

Patator da FiRsT
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
best practices for subprocs & pipes in python bardinjw Programming 0 11-28-2005 12:27 PM
Need help w/ shell handling 3 commands/2 pipes sptchamp Programming 3 07-15-2004 09:37 PM
some brainstorming and personal projects poeta_boy General 6 04-27-2004 10:57 PM
Console commands && GUI DaFrEQ Programming 10 05-29-2003 12:00 PM
vim commands in perl JohanLingen Programming 5 01-08-2003 04:43 AM


All times are GMT -5. The time now is 03:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration