File: 17_xhtml.t

package info (click to toggle)
libhtml-fillinform-perl 2.22-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 356 kB
  • sloc: perl: 649; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 963 bytes parent folder | download | duplicates (7)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- Mode: Perl; -*-

use strict;

$^W = 1;

print "1..1\n";

use HTML::FillInForm;
use CGI;

my $html = <<EOF;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<body>
    <input type="radio" name="status" value=0 />Canceled<br>
    <input type="radio" name="status" value=1 />Confirmed<br>
    <input type="radio" name="status" value=2 />Wait List<br>

    <input type="radio" name="status" value=3 />No Show<br>
    <input type="radio" name="status" value=4 />Moved to Another Class<br>
    <input type="radio" name="status" value=5 />Late Cancel<br>
</body>
</html>
EOF

my $q = CGI->new;
$q->param('status', 1 );

my $fif = HTML::FillInForm->new;

my $output = $fif->fill(
    scalarref => \$html,
    fobject => $q
);

my $matches;
while ($output =~ m!( />)!g) {
  $matches++;
}

if ($matches == 6) {
  print "ok 1\n";
} else {
  print "not ok 1\n";
}

print $output;