Sounds like you're evolving - I highly recommend proceeding the next step & evolving to a MVC CGI framework, like CGI::Application - it would work something like this:
#!/usr/bin/perl -wT # this would be your .cgi file... let's say name.cgi use strict; use CGI::Carp qw( fatalsToBrowser ); $|++; use MyApp; my $webapp = MyApp->new(); $webapp->run();
Then a complementing cgiapp module:
package MyApp; use strict; use base 'CGI::Application'; sub setup { my $self = shift; my $self->run_modes( [ qw( start add addnew ) ] ); } sub start { my $self = shift; my $query = $self->query; my $output = $query->start_html( -title => 'Simple Script' ); $output .= '<a href="name.cgi?rm=add">Start</a>' . $query->end_html; return $output; } sub add { my $self = shift; my $query = $self->query; my $output = $query->start_html(-title=>$title.' Enter your name'); $output .= $query->start_form . $query->hidden( 'rm', 'addnew' ) . $query->textfield('name','Enter Your name',20) . $query->submit('submit') . $query->reset . $query->end_form . $query->end_html; return $output; } sub addnew { my $self = shift; my $query = $self->query; my $text = 'Error , You should write your name'; if ( $query->param( 'name' ) ) { $text = "Welcome $name"; } my $output = $query->p( $text ); return $output; } 1;
HTH & Good Luck! - Jason

Update: Feel free to drop in on the #cgiapp channel on irc.perl.org
Update2: bugfix ... that's not really the best code -- just something I whipped up as a prototype


In reply to Re: Multi page form by Purdy
in thread Multi page form by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.