Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/usr/share/doc/perl-Event/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/usr/share/doc/perl-Event/t/hup.t
#!/usr/bin/perl -w

BEGIN {
    if ($^O eq 'MSWin32') {
	print "1..0 # skipped; Win32 is too strange\n";
	exit;
    }
}

# contributed by Gisle Aas <aas@gaustad.sys.sol.no>

use Test; plan test => 1;
use Event qw(loop unloop);

$| = 1;
my $pid = open(PIPE, "-|");
die unless defined $pid;
unless ($pid) {
    # child
    for (1..100) { print "."; }
    print "\n";
    exit;
}

my $bytes = 0;
Event->io(poll => "r",
          fd   => \*PIPE,
          cb   => sub {
             my $e = shift;
	     my $buf;
             my $n = sysread(PIPE, $buf, 10);
             $bytes += $n;
             #print "Got $n bytes\n";
             unloop() unless $n;
          });

loop();

ok $bytes, 101;

Hry