home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _4f172634debce2f22f5aaab817e2799e < prev    next >
Text File  |  2004-06-01  |  2KB  |  67 lines

  1.  
  2.  
  3.     use Win32::Pipe;
  4.  
  5.  
  6.         ####
  7.         #   You may notice that named pipe names are case INsensitive!
  8.         ####
  9.  
  10.     $PipeName = "\\\\.\\pipe\\TEST this LoNG Named Pipe!";
  11.  
  12.     print "I am falling asleep for few seconds, so that we give time\nFor the server to get up and running.\n";
  13.     sleep(4);
  14.     print "\nOpening a pipe ...\n";
  15.  
  16.  
  17.  
  18.     if ($Pipe = new Win32::Pipe($PipeName)){
  19.         print "\n\nPipe has been opened, writing data to it...\n";
  20.         print "-------------------------------------------\n";
  21.         $iFlag2 = 1;
  22.         $Pipe->Write( "\n" . Win32::Pipe::Credit() . "\n\n");
  23.         while($iFlag2){
  24.             print "\nCommands:\n";
  25.             print "  FILE:xxxxx  Dumps the file xxxxx.\n";
  26.             print "  Credit      Dumps the credit screen.\n";
  27.             print "  Quit        Quits this client (server remains running).\n";
  28.             print "  Exit        Exits both client and server.\n";
  29.             print "  -----------------------------------------\n";
  30.  
  31.             $In = <STDIN>;
  32.             chop($In);
  33.  
  34.             if (($File = $In) =~ s/^file:(.*)/$1/i){
  35.                 if (-s $File){
  36.                     if (open(FILE, "< $File")){
  37.                         while ($File = <FILE>){
  38.                             $In .= $File;
  39.                         };
  40.                         close(FILE);
  41.                         undef $File;
  42.                     }
  43.                 }
  44.             }
  45.             if($In =~ /^credit$/i){
  46.                 $In = "\n" . Win32::Pipe::Credit() . "\n\n";
  47.             }
  48.  
  49.             $iFlag2 = $Pipe->Write("$In");
  50.             if($In =~ /^(exit|quit)$/i){
  51.                 print "\nATTENTION: Closing due to user request.\n";
  52.                 $iFlag2 = 0;
  53.             }
  54.  
  55.             undef $In;
  56.  
  57.         }
  58.         $Pipe->Close();
  59.     }else{
  60.         ($Error, $ErrorText) = Win32::Pipe::Error();
  61.         print "Error:$Error \"$ErrorText\"\n";
  62.         sleep(4);
  63.     }
  64.  
  65.  
  66.  
  67.