Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
perl script question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
davoid
n00b
n00b


Joined: 29 Jun 2002
Posts: 26
Location: Montreal, Canada

PostPosted: Wed Oct 02, 2002 3:13 pm    Post subject: perl script question Reply with quote

Hello,

I wrote a quick perl script to automatically start ripping from icecast/smartcast servers given as .pls files (playlist) with http:// ressources.

My question is how can I detach streamripper from the perl script. That is in my foreach loop, I have something like`streamripper $line &` but it does not detach... Any ideas?

I am thinking of thread programming but that's overkill. ALso I could hack streamripper to have it automatically detach when iI pass it -d, but I am lazy..

Thanks!!


--davoid
_________________
At first they laugh at you, then they ignore you then they fight you and then you win. --Gandhi
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Oct 02, 2002 5:41 pm    Post subject: Reply with quote

Can you do something like:
Code:
unless( fork ) {
  exec( "streamripper", $line );
}

The perlipc man page has some examples of fork/exec. You may need to redirect STDOUT and STDERR to /dev/null, as described in the section "Complete Dissociation of Child from Parent".
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
phong
Bodhisattva
Bodhisattva


Joined: 16 Jul 2002
Posts: 778
Location: Michigan - 15 & Ryan

PostPosted: Wed Oct 02, 2002 7:56 pm    Post subject: Reply with quote

You may need a handler for $SIG{CHLD}. Also, check out POSIX::setsid().
_________________
"An empty head is not really empty; it is stuffed with rubbish. Hence the difficulty of forcing anything into an empty head."
-- Eric Hoffer
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum