This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
The program spawned from process.t needs to set up @INC correctly, as
[perl5.git] / ext / Test / Harness / t / sample-tests / delayed
1 # Used to test Process.pm
2 BEGIN {
3     if ( $ENV{PERL_CORE} ) {
4         @INC = '../lib';
5     }
6 }
7
8 use Time::HiRes qw(sleep);
9
10 my $delay = 0.01;
11
12 $| = 1;
13
14 my @parts = (
15     "1.",
16     ".5\n",
17     "ok 1 00000\n",
18     "ok 2\nnot",
19     " ok 3",
20     "\nok 4\nok ",
21     "5 00000",
22     ""
23 );
24
25 my $delay_at = shift || 0;
26
27 while (@parts) {
28     sleep $delay if ( $delay_at & 1 );
29     $delay_at >>= 1;
30     print shift @parts;
31 }
32 sleep $delay if ( $delay_at & 1 );