[elinks-users] CGI Scripts

Steve Holmes steve at holmesgrown.com
Thu Apr 26 09:39:38 PDT 2007

On Wed, Apr 25, 2007 at 07:51:43PM +0200, Witold Filipczyk wrote:
> Does assertion failure occur in src/document/html/parser/forms.c:99 ?
> You don't have <form action=...> set, do you?
> Could you send the code of CGI scripts?

First I did a little more experimentation and got the assertion error to
go away but then the parameter list is always empty.  BTW, I got this
sample script to work fine with my Apache server.  Oh, to answer
previous questions, I'm still using version 0.11.1 and the error goes
away so quickly, I cannot capture it; I know it is line 99 of something
with form.c in the name.  The error goes away and the CGI form comes
back up.

My experimentation was to add the action=... to the form definition and
that actually stopped the assertion err as I mentioned before.  The
following script is my original version that still demos the error.  It
uses the CGI object in Perl 5.8.  Just press on the shout or scream
buttons to exhibit the problem.  The sample is below.
----- Begin script -----

use CGI ':standard';

print header;
print start_html("Example CGI.pm Form");
print "<h1> Example CGI.pm Form</h1>\en";
print end_html;

sub print_prompt {
    print start_form(-name=>'cgi-bin/sample1.cgi');
    print "<em>What's your name?</em><br>";
    print textfield('name');
    print checkbox('Not my real name');

    print "<p><em>Where can you find English Sparrows?</em><br>";
    print checkbox_group(
                          -name=>'Sparrow locations',

    print "<p><em>How far can they fly?</em><br>",
            -name=>'how far',
            -values=>['10 ft','1 mile','10 miles','real far'],
            -default=>'1 mile');

    print "<p><em>What's your favorite color?</em>  ";
    print popup_menu(-name=>'Color',

    print hidden('Reference','Monty Python and the Holy Grail');

    print "<p><em>What have you got there?</em><br>";
    print scrolling_list(
        -name=>'possessions'       -values=>['A Coconut','A Grail','An Icon',
               'A Sword','A Ticket'],

    print "<p><em>Any parting comments?</em><br>";
    print textarea(-name=>'Comments',

    print "<p>",reset;
    print submit('Action','Shout');
    print submit('Action','Scream');
    print endform;
    print "<hr>\n";

sub do_work {

    print "<h2>Here are the current settings in this form</h2>";
    foreach $key (param) {
        print "<strong>$key</strong> -> ";
        @values = param($key);
        print join(", ", at values),"<br>\n";

sub print_tail {
    print <<END;
        <address>Lincoln D. Stein</address><br>
        <a href="/">Home Page</a>
----- End script -----

HolmesGrown Solutions
The best solutions for the best price!

More information about the elinks-users mailing list