Hello

I had problems trying to access a program using libwww-perl and concluded 
that libwww-perl has a diferent behaviour than netscape (and other browsers) 
regarding empty fields. This is exemplified by the script attached, where n 
is empty in context2, which produces 

content1 -> n=aaaa&notes=%0Asome%20stuff%0A
content2 -> notes=%0Asome%20stuff%0A 

using libwww, but would produce

content1 -> n=aaaa&notes=%0Asome%20stuff%0A
content2 -> n=&notes=%0Asome%20stuff%0A 

using (eg) netscape.

Which behaviour is "legal"? Is there a simple way to force a different 
behaviour?

Thanks

---------- Test.pl 

use HTML::Form;
use LWP::UserAgent;

my $res1 = HTTP::Response->new("200", "OK");

#Variable n has value "aaaa"

$content1 = '<body>
<form method=POST action="test">
<input name=n value="aaaa" size=40 maxlength=200>
<textarea name=notes>
some stuff
</textarea>
<input type=submit value=Ok>
</form>
</body>';

$res1->content($content1);
my $form1 = HTML::Form->parse($res1->content, "http://foo.bar.moc/");

$res1 = $form1->click(); 
print "content1 -> " . $res1->content . "\n";

# Empty variable n

my $res2 = HTTP::Response->new("200", "OK");

$content2 = '<body>
<form method=POST action="test">
<input name=n size=40 maxlength=200>
<textarea name=notes>
some stuff
</textarea>
<input type=submit value=Ok>
</form>
</body>';

$res2->content($content2);
my $form2 = HTML::Form->parse($res2->content, "http://foo.bar.moc/");

$res2 = $form2->click(); 
print "content2 -> " . $res2->content . "\n";

Reply via email to