I want to parse the form elements in a HTML file to fetch their key/value pairs. I have written the following code using ActivePerl for Windows -->
use HTTP::Request::Common;
use HTML::Form;
$htmlfilename = "/defaults.shtml";
$ipaddress = " //This is an imaginary URL
@forms = HTML::Form->parse($htmlfilename, $ipaddress);
$x = @forms;
print "size of \@forms = $x";
But this code prints the size of @forms as zero. What is the problem here?
I am very new to perl so do not know if this kinda code would ever work. If it does not, then can anyone tell me, how do I obtain the key/value pairs for all form elements in a HTML file. Some working, sample code would be very useful.
use HTTP::Request::Common;
use HTML::Form;
$htmlfilename = "/defaults.shtml";
$ipaddress = " //This is an imaginary URL
@forms = HTML::Form->parse($htmlfilename, $ipaddress);
$x = @forms;
print "size of \@forms = $x";
But this code prints the size of @forms as zero. What is the problem here?
I am very new to perl so do not know if this kinda code would ever work. If it does not, then can anyone tell me, how do I obtain the key/value pairs for all form elements in a HTML file. Some working, sample code would be very useful.