User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 391,648 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,872 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser:
Views: 796 | Replies: 0
Reply
Join Date: Oct 2007
Posts: 1
Reputation: LH2007 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
LH2007 LH2007 is offline Offline
Newbie Poster

Process manager with perl

  #1  
Oct 24th, 2007
hi everybody!I'm newbie.I have a exercise about perl like this:
Creating 2 process P1(parent) P2 (child)
P1 get characters from keyboard
If press Ctrl-c P1 send a signal terminate P2
......................................
My ideal is :

 ( perl )

   
      $handle=IO::Socket::INET->(proto=>"tcp",
   
                                          PeerAddr=>$host,
   
                                           PeerPort=>$port)
      $handle->autoflush(1);
      die 'can't fork:$!' unless defined($pid=fork());
      if($pid) {
      while(defined($line=<$handle>)){
      print STDOUT $line;
              }

         kill("TERM"=>$pid);
      }

But my problem is press Ctrl-C.I think,can i creat a subroutine to respond to Ctrl-C like that:
      $SIG{INT}=\&killchild;
        sub killchild{
      .............
      }
 



Please help me
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Perl Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 1:16 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC