home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Ghostscript / SendIt.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  657 b   |  30 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Ghostscript.pm.  Changes made here will be lost.
  2. package Tk::Ghostscript;
  3.  
  4. sub SendIt
  5. {
  6.  my $w  = shift;
  7.  my $fh = $w->{'FH'};
  8.  my $pend = $w->{'Pending'};
  9.  while (@$pend)
  10.   {
  11.    my $line = shift(@$pend);           
  12.    my $len  = length($line);           
  13.    my $done = syswrite($fh,$line,$len);
  14.    $done = 0 unless (defined $done);
  15.    if ($done < $len)
  16.     {
  17.      unshift(@{$pend},substr($line,$done));
  18.      last;
  19.     }
  20.   }
  21.  if (exists $w->{'mwin'})
  22.   {
  23.    $w->SendClientMessage('NEXT',$w->{'mwin'},8,"");
  24.    delete $w->{'mwin'};
  25.   }
  26.  $w->fileevent($fh,'writable',"") unless (@$pend);
  27. }
  28.  
  29. 1;
  30.