File: form.t

package info (click to toggle)
libwww-perl 5.47-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 692 kB
  • ctags: 345
  • sloc: perl: 5,458; makefile: 37; sh: 6
file content (30 lines) | stat: -rw-r--r-- 569 bytes parent folder | download
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
print "1..4\n";

use HTML::Form;

my @f = HTML::Form->parse("", "http://localhost");
print "not " if @f;
print "ok 1\n";

@f = HTML::Form->parse(<<'EOT', "http://localhost/");

<form action="abc">

<input name="name" value="Gisle">

</form>

EOT

print "not " unless @f == 1;
print "ok 2\n";

my $f = shift @f;
print "not " unless $f->value("name") eq "Gisle";
print "ok 3\n";

$f->value(name => "Gisle Aas");
$req = $f->click;
print "not " unless $req && $req->method eq "GET"
	                 && $req->uri eq "http://localhost/abc?name=Gisle%20Aas";
print "ok 4\n";