File: alarm.t

package info (click to toggle)
libcgi-compile-perl 0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 372; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 519 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env perl;
use strict;
use warnings;

use Test::More $^O eq 'MSWin32' ? (
    skip_all => 'not supported on Win32')
: (
    tests => 1
);

use CGI::Compile;
use Capture::Tiny 'capture_stdout';

my $cgi =<<'EOL';
#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes 'ualarm';

print "Content-Type: text/plain\015\012\015\012";

$SIG{ALRM} = sub { print "ALARM\015\012" };

ualarm 50;
sleep 1;
EOL

my $sub = CGI::Compile->compile(\$cgi);

like capture_stdout { $sub->() },
     qr/ALARM/;

done_testing;